Mercurial > libavcodec.hg
comparison ws-snd1.c @ 5674:ca944f1db2b3 libavcodec
Add checks on input/output buffers size for some audio decoders
author | kostya |
---|---|
date | Thu, 13 Sep 2007 05:59:58 +0000 |
parents | 05e932ddaaa9 |
children | 64394c86a053 |
comparison
equal
deleted
inserted
replaced
5673:9810f0bbacb2 | 5674:ca944f1db2b3 |
---|---|
60 out_size = AV_RL16(&buf[0]); | 60 out_size = AV_RL16(&buf[0]); |
61 *data_size = out_size * 2; | 61 *data_size = out_size * 2; |
62 in_size = AV_RL16(&buf[2]); | 62 in_size = AV_RL16(&buf[2]); |
63 buf += 4; | 63 buf += 4; |
64 | 64 |
65 if (out_size > *data_size) { | |
66 av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n"); | |
67 return -1; | |
68 } | |
69 if (in_size > buf_size) { | |
70 av_log(avctx, AV_LOG_ERROR, "Frame data is larger than input buffer\n"); | |
71 return -1; | |
72 } | |
65 if (in_size == out_size) { | 73 if (in_size == out_size) { |
66 for (i = 0; i < out_size; i++) | 74 for (i = 0; i < out_size; i++) |
67 *samples++ = (*buf++ - 0x80) << 8; | 75 *samples++ = (*buf++ - 0x80) << 8; |
68 return buf_size; | 76 return buf_size; |
69 } | 77 } |