mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
* simple fix to avoid memcpy with len < 0
Originally committed as revision 180 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
525782f33f
commit
c152c98327
@ -2268,11 +2268,13 @@ static int decode_frame(AVCodecContext * avctx,
|
|||||||
len = HEADER_SIZE - len;
|
len = HEADER_SIZE - len;
|
||||||
if (len > buf_size)
|
if (len > buf_size)
|
||||||
len = buf_size;
|
len = buf_size;
|
||||||
|
else if (len > 0) {
|
||||||
memcpy(s->inbuf_ptr, buf_ptr, len);
|
memcpy(s->inbuf_ptr, buf_ptr, len);
|
||||||
buf_ptr += len;
|
buf_ptr += len;
|
||||||
s->inbuf_ptr += len;
|
|
||||||
buf_size -= len;
|
buf_size -= len;
|
||||||
if ((s->inbuf_ptr - s->inbuf) == HEADER_SIZE) {
|
s->inbuf_ptr += len;
|
||||||
|
}
|
||||||
|
if ((s->inbuf_ptr - s->inbuf) >= HEADER_SIZE) {
|
||||||
got_header:
|
got_header:
|
||||||
header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) |
|
header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) |
|
||||||
(s->inbuf[2] << 8) | s->inbuf[3];
|
(s->inbuf[2] << 8) | s->inbuf[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user