https://github.com/N-BodyShop/changa
Revision 5fc50e324f199c27f60370c95bd205c1a33b0608 authored by Tim Haines on 10 December 2017, 10:35:00 UTC, committed by Tim Haines on 27 October 2018, 19:46:28 UTC
Compiling with gcc-7.2 and later warngs that calculated string sizes
could possibly be larger than the buffer size. This also fixes possible
stack-smashing in dumpframe.cpp:dfReadColorMapFile.

Usage of DumpFrameContext.FileName could not be changed without
altering the layout of DumpFrameContext, so it was left alone.

Change-Id: Ib57f3d868ce0e37251658e9778c88fc4dc66ac82
1 parent f9a522d
Raw File
Tip revision: 5fc50e324f199c27f60370c95bd205c1a33b0608 authored by Tim Haines on 10 December 2017, 10:35:00 UTC
Fix possible buffer overflows in calls to sprintf
Tip revision: 5fc50e3
cosmo.h
#ifndef COSMO_HINCLUDED
#define COSMO_HINCLUDED

#if defined(__cplusplus)
extern "C" {
#endif
/* Cosmo routines originally written for PKDGRAV by Thomas Quinn */

/** @brief Cosmological parameters */
typedef struct csmContext {
    int bComove;	   
    double dHubble0;
    double dOmega0;
    double dLambda;
    double dOmegaRad;
    double dQuintess; /* w = -1/2 equation of  state */
    double dOmegab;
    } * CSM;

void csmInitialize(CSM *pcsm);
double csmExp2Hub(CSM csm, double dExp);
double csmTime2Hub(CSM csm,double dTime);
double csmExp2Time(CSM csm,double dExp);
double csmTime2Exp(CSM csm,double dTime);
double csmComoveDriftInt(CSM csm, double dIExp);
double csmComoveKickInt(CSM csm, double dIExp);
double csmComoveDriftFac(CSM csm,double dTime,double dDelta);
double csmComoveKickFac(CSM csm,double dTime,double dDelta);
double csmComoveLookbackTime2Exp(CSM csm,double dComoveTime);
double csmGrowthFac(CSM csm, double dExp);
double csmGrowthFacDot(CSM csm, double dExp);
double csmExp2Om(CSM csm, double dExp);
#if defined(__cplusplus)
}

inline void operator|(PUP::er &p, struct csmContext &csm) {
    p|csm.bComove;	   
    p|csm.dHubble0;
    p|csm.dOmega0;
    p|csm.dLambda;
    p|csm.dOmegaRad;
    p|csm.dQuintess;
    p|csm.dOmegab;
    }

#endif
     
#endif
back to top