njoy / NJOY2016

Nuclear data processing with legacy NJOY
https://www.njoy21.io/NJOY2016
Other
95 stars 82 forks source link

Fix wrong memory addresses due to not accounted GROUPR offset #262

Closed kernie closed 1 year ago

kernie commented 1 year ago

GROUPR writes gendf data in a compact way and let us know, what the offset is.

The dlayxs part of CCCR loops over the full energy group range in container variable a where it should loop only until the offset. Thereby, on chance uninitialized or invalid memory may be addressed and may lead at best to a crash or simply runs without error but resulting in values like 1.E+44 for delayed spectra.

This commit introduces the offset and corrects 2 loops. Moreover, a check is introduced if the requested memory fits into the a variable. The a size variable isiza was moved to a parameter statement and renamed to account for 4 byte and 8 byte equivalence'd variables.

kernie commented 1 year ago

To see the erroneous bevavior, one can take input.cccr_u232_361.txt with ENDF6 data of U-232. It uses the SHEM-361 group structure.