From bfeacc901606ac3c00fac5b7c7779617b7c10579 Mon Sep 17 00:00:00 2001 From: Renat Nasyrov Date: Fri, 17 Jul 2026 00:02:40 +0200 Subject: [PATCH] Check empty sample by .len, not by .num_samples field. pdx.c:28 leaves .num_samples uninitialized (=initialized with garbage) if the input sample is not used. This leads to program crash. --- pdx2sf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdx2sf2.c b/pdx2sf2.c index 834837d..b2ff260 100644 --- a/pdx2sf2.c +++ b/pdx2sf2.c @@ -90,7 +90,7 @@ int main(int argc, char **argv) { memset(instGenLists, 0, genSize); x = 0; for(int j = 0; j < PDX_NUM_SAMPLES; j++) { - if(p.samples[j].num_samples > 0) { + if(p.samples[j].len > 0) { int k = x * GENS_PER_ZONE; instGenLists[k].sfGenOper = keyRange; instGenLists[k].genAmount.ranges.byHi = BASE_NOTE + j;