blob: 49b5a6f5d45c26e313bdc29478d6b52106311da3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
$NetBSD: patch-ax,v 1.9 2009/02/19 12:58:03 drochner Exp $
--- src/demuxers/demux_4xm.c.orig 2009-02-10 18:32:23.000000000 +0100
+++ src/demuxers/demux_4xm.c
@@ -190,12 +190,12 @@ static int open_fourxm_file(demux_fourxm
return 0;
}
const uint32_t current_track = _X_LE_32(&header[i + 8]);
+ if (current_track >= UINT_MAX / sizeof(audio_track_t) - 1) {
+ free(header);
+ return 0;
+ }
if (current_track + 1 > fourxm->track_count) {
fourxm->track_count = current_track + 1;
- if (fourxm->track_count >= UINT_MAX / sizeof(audio_track_t)) {
- free(header);
- return 0;
- }
fourxm->tracks = realloc(fourxm->tracks,
fourxm->track_count * sizeof(audio_track_t));
if (!fourxm->tracks) {
|