Unified · Split
| @@ -54,9 +54,9 @@ static enum AVCodecID aiff_codec_get_id(int bps) · 53 unmodified lines | ||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /* returns the size of the found tag */ |
| 57 | −static int get_tag(AVIOContext *pb, uint32_t * tag) | |
| 57 | +static int64_t get_tag(AVIOContext *pb, uint32_t * tag) | |
| 58 | 58 | { |
| 59 | − int size; | |
| 59 | + int64_t size; | |
| 60 | 60 | |
| 61 | 61 | if (avio_feof(pb)) |
| 62 | 62 | return AVERROR(EIO); |
| @@ -64,16 +64,16 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) · 1 unmodified line | ||
| 64 | 64 | *tag = avio_rl32(pb); |
| 65 | 65 | size = avio_rb32(pb); |
| 66 | 66 | |
| 67 | − if (size < 0) | |
| 68 | − size = 0x7fffffff; | |
| 69 | − | |
| 70 | 67 | return size; |
| 71 | 68 | } |
| 72 | 69 | |
| 73 | 70 | /* Metadata string read */ |
| 74 | −static void get_meta(AVFormatContext *s, const char *key, int size) | |
| 71 | +static void get_meta(AVFormatContext *s, const char *key, int64_t size) | |
| 75 | 72 | { |
| 76 | − uint8_t *str = av_malloc(size+1U); | |
| 73 | + uint8_t *str = NULL; | |
| 74 | + | |
| 75 | + if (size < SIZE_MAX) | |
| 76 | + str = av_malloc(size+1); | |
| 77 | 77 | |
| 78 | 78 | if (str) { |
| 79 | 79 | int res = avio_read(s->pb, str, size); |
| @@ -90,7 +90,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) · 10 unmodified lines | ||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /* Returns the number of sound data frames or negative on error */ |
| 93 | −static int get_aiff_header(AVFormatContext *s, int size, | |
| 93 | +static int get_aiff_header(AVFormatContext *s, int64_t size, | |
| 94 | 94 | unsigned version) |
| 95 | 95 | { |
| 96 | 96 | AVIOContext *pb = s->pb; |
| @@ -102,9 +102,6 @@ static int get_aiff_header(AVFormatContext *s, int size, · 5 unmodified lines | ||
| 102 | 102 | unsigned int num_frames; |
| 103 | 103 | int channels; |
| 104 | 104 | |
| 105 | − if (size == INT_MAX) | |
| 106 | − return AVERROR_INVALIDDATA; | |
| 107 | − | |
| 108 | 105 | if (size & 1) |
| 109 | 106 | size++; |
| 110 | 107 | par->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -216,7 +213,8 @@ static int aiff_probe(const AVProbeData *p) · 105 unmodified lines | ||
| 216 | 213 | /* aiff input */ |
| 217 | 214 | static int aiff_read_header(AVFormatContext *s) |
| 218 | 215 | { |
| 219 | − int ret, size, filesize; | |
| 216 | + int ret; | |
| 217 | + int64_t filesize, size; | |
| 220 | 218 | int64_t offset = 0, position; |
| 221 | 219 | uint32_t tag; |
| 222 | 220 | unsigned version = AIFF_C_VERSION1; |
| @@ -227,7 +225,7 @@ static int aiff_read_header(AVFormatContext *s) · 4 unmodified lines | ||
| 227 | 225 | |
| 228 | 226 | /* check FORM header */ |
| 229 | 227 | filesize = get_tag(pb, &tag); |
| 230 | − if (filesize < 0 || tag != MKTAG('F', 'O', 'R', 'M')) | |
| 228 | + if (filesize < 4 || tag != MKTAG('F', 'O', 'R', 'M')) | |
| 231 | 229 | return AVERROR_INVALIDDATA; |
| 232 | 230 | |
| 233 | 231 | /* AIFF data type */ |
| @@ -254,10 +252,7 @@ static int aiff_read_header(AVFormatContext *s) · 20 unmodified lines | ||
| 254 | 252 | if (size < 0) |
| 255 | 253 | return size; |
| 256 | 254 | |
| 257 | − if (size >= 0x7fffffff - 8) | |
| 258 | − filesize = 0; | |
| 259 | − else | |
| 260 | − filesize -= size + 8; | |
| 255 | + filesize -= size + 8; | |
| 261 | 256 | |
| 262 | 257 | switch (tag) { |
| 263 | 258 | case MKTAG('C', 'O', 'M', 'M'): /* Common chunk */ |