Skip to content

Commit f6ad6c4

Browse files
committed
decoder_voc: fix possible use-after-free
Fixes #726
1 parent 333dfd8 commit f6ad6c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/decoder_voc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,14 @@ static bool ParseVocFile(SDL_IOStream *io, VOC_AudioData *adata, SDL_PropertiesI
288288
return SDL_SetError("VOC has a LOOPEND without a matching LOOP");
289289
}
290290

291+
const int loopcnt = loop_start->loop_count;
291292
VOC_Block *block = AddVocLoopBlock(adata, -2);
292293
if (!block) {
293294
return false;
294295
}
295296

296297
if (total_frames != -1) {
297-
total_frames += loop_frames * loop_start->loop_count;
298+
total_frames += loop_frames * loopcnt;
298299
}
299300

300301
loop_start = NULL;

0 commit comments

Comments
 (0)