diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-06-14 23:18:07 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-06-15 00:53:34 +0000 |
commit | a09ae4ef654b409cc21d3cae4d691988164888c6 (patch) | |
tree | a6686c48091522e5c8d3264b46cdb38fedaa418d /libavcodec/pngdec.c | |
parent | 59c122b3b0a00808e3c4f534927755d89e7baa62 (diff) | |
download | ffmpeg-a09ae4ef654b409cc21d3cae4d691988164888c6.tar.gz |
Remove duplicated png and mng signatures.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/pngdec.c')
-rw-r--r-- | libavcodec/pngdec.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index e55a3823c0..5bfe07ba5d 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -395,21 +395,23 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p; uint8_t *crow_buf_base = NULL; uint32_t tag, length; + int64_t sig; int ret; FFSWAP(AVFrame *, s->current_picture, s->last_picture); avctx->coded_frame= s->current_picture; p = s->current_picture; + bytestream2_init(&s->gb, buf, buf_size); + /* check signature */ - if (buf_size < 8 || - memcmp(buf, ff_pngsig, 8) != 0 && - memcmp(buf, ff_mngsig, 8) != 0) { + sig = bytestream2_get_be64(&s->gb); + if (sig != PNGSIG && + sig != MNGSIG) { av_log(avctx, AV_LOG_ERROR, "Missing png signature\n"); return -1; } - bytestream2_init(&s->gb, buf + 8, buf_size - 8); s->y= s->state=0; // memset(s, 0, sizeof(PNGDecContext)); |