OasisLMF / ktools

In-memory simulation kernel for loss modelling.
BSD 3-Clause "New" or "Revised" License
28 stars 19 forks source link

Sample size of 1 causes segmentation fault in aalcalc when no Average Loss Convergence Table is requested #310

Closed hchagani-oasislmf closed 2 years ago

hchagani-oasislmf commented 2 years ago

Issue Description

Input data with a sample size of 1 yields a segmentation fault in aalcalc when no Average Loss Convergence Table (ALCT) is requested. This is because the vector vec_sample_aal_ is not resized correctly under these circumstances. The work around is to request the ALCT output on the command line:

$ aalcalc -Kgul_S1_summaryaalcalc
FATAL: aalcalc: Segment fault at address: 0x24
$ aalcalc -Kgul_S1_summaryaalcalc -c alct.csv
summary_id,type,mean,standard_deviation
1,1,235819.239625,594470.164081
1,2,219978.978748,579156.573756

Steps to Reproduce (Bugs only)

Run PiWind with sample size of 1 (set "number_of_samples": 1 in analysis_settings.json).

Version / Environment information

Bug introduced in ktools v3.9.0, corresponding to MDK v1.26.0. This was when the ALCT was introduced.