Mercurial > libavcodec.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
122:56e34b70ef5d | 123:3073d4ea6ee5 |
---|---|
2266 /* no header seen : find one. We need at least HEADER_SIZE | 2266 /* no header seen : find one. We need at least HEADER_SIZE |
2267 bytes to parse it */ | 2267 bytes to parse it */ |
2268 len = HEADER_SIZE - len; | 2268 len = HEADER_SIZE - len; |
2269 if (len > buf_size) | 2269 if (len > buf_size) |
2270 len = buf_size; | 2270 len = buf_size; |
2271 else if (len > 0) { | |
2271 memcpy(s->inbuf_ptr, buf_ptr, len); | 2272 memcpy(s->inbuf_ptr, buf_ptr, len); |
2272 buf_ptr += len; | 2273 buf_ptr += len; |
2273 s->inbuf_ptr += len; | |
2274 buf_size -= len; | 2274 buf_size -= len; |
2275 if ((s->inbuf_ptr - s->inbuf) == HEADER_SIZE) { | 2275 s->inbuf_ptr += len; |
2276 } | |
2277 if ((s->inbuf_ptr - s->inbuf) >= HEADER_SIZE) { | |
2276 got_header: | 2278 got_header: |
2277 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | | 2279 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | |
2278 (s->inbuf[2] << 8) | s->inbuf[3]; | 2280 (s->inbuf[2] << 8) | s->inbuf[3]; |
2279 if (check_header(header) < 0) { | 2281 if (check_header(header) < 0) { |
2280 /* no sync found : move by one byte (inefficient, but simple!) */ | 2282 /* no sync found : move by one byte (inefficient, but simple!) */ |