summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorZdenek Kabelac <kabi@informatics.muni.cz>2001-10-23 19:03:33 +0000
committerZdenek Kabelac <kabi@informatics.muni.cz>2001-10-23 19:03:33 +0000
commitc152c98327ae10cefa2bb33514a1c447f1f2a9ee (patch)
tree21c4e6e2177d53c4fae7d318000c8a5ac527cf18 /libavcodec
parent525782f33ff4be92bb27967c021fc244c92bdebc (diff)
downloadffmpeg-streaming-c152c98327ae10cefa2bb33514a1c447f1f2a9ee.zip
ffmpeg-streaming-c152c98327ae10cefa2bb33514a1c447f1f2a9ee.tar.gz
* simple fix to avoid memcpy with len < 0
Originally committed as revision 180 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegaudiodec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index ca610d6..80a145b 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -2268,11 +2268,13 @@ static int decode_frame(AVCodecContext * avctx,
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];
OpenPOWER on IntegriCloud