star-hitran

Load line-by-line data from the HITRAN database
git clone git://git.meso-star.fr/star-hitran.git
Log | Files | Refs | README | LICENSE

commit 44e117e8f5e657c72e76f81207e953aae3e5e371
parent 46d3a21f10e9b7305dd8df20837f0e412c2a0ad0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 14 Feb 2022 15:54:24 +0100

Check the sizeof the transition to load

Return an error if a transition is not of the expected size even if we
do not yet load all the data.

Diffstat:
Msrc/shitran_transitions.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/shitran_transitions.c b/src/shitran_transitions.c @@ -137,6 +137,17 @@ parse_transition(struct shitran_transitions* transitions, struct txtrdr* txtrdr) #undef NEXT #undef PARSE + /* Check the size of the remaining data to ensure that there is at least the + * expected number of bytes wrt the HITRAN fileformat */ + *end = backup; + str = end; + if(strlen(str) != 93) { + log_err(transitions->shitran, "%s:%lu: missing data after delta air.\n", + param.path, (unsigned long)param.line); + res = RES_BAD_ARG; + goto error; + } + res = darray_transition_push_back(&transitions->transitions, &tr); if(res != RES_OK) { log_err(transitions->shitran,