Mercurial > libavcodec.hg
diff mpegaudiodec.c @ 123:3073d4ea6ee5 libavcodec
* simple fix to avoid memcpy with len < 0
author | kabi |
---|---|
date | Tue, 23 Oct 2001 19:03:33 +0000 |
parents | 46ee548e47e4 |
children | 036ec148fb18 |
line wrap: on
line diff
--- a/mpegaudiodec.c Tue Oct 23 19:02:55 2001 +0000 +++ b/mpegaudiodec.c Tue Oct 23 19:03:33 2001 +0000 @@ -2268,11 +2268,13 @@ len = HEADER_SIZE - len; if (len > buf_size) len = buf_size; + else if (len > 0) { memcpy(s->inbuf_ptr, buf_ptr, len); buf_ptr += len; - s->inbuf_ptr += 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: header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | (s->inbuf[2] << 8) | s->inbuf[3];