[FFmpeg-devel] [PATCH] jpeg2000dec: Fix valgrind warning with lengthinc == 1
Michael Niedermayer
michaelni at gmx.at
Mon May 6 21:43:29 CEST 2013
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/jpeg2000dec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index ac69d7e..8fed068 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -637,12 +637,11 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s,
return AVERROR(EINVAL);
/* Code-block data can be empty. In that case initialize data
* with 0xFFFF. */
- if (cblk->lengthinc > 0) {
- bytestream_get_buffer(&s->buf, cblk->data, cblk->lengthinc);
- } else {
+ if (cblk->lengthinc < 2) {
cblk->data[0] = 0xFF;
cblk->data[1] = 0xFF;
}
+ bytestream_get_buffer(&s->buf, cblk->data, cblk->lengthinc);
cblk->length += cblk->lengthinc;
cblk->lengthinc = 0;
}
--
1.7.9.5
More information about the ffmpeg-devel
mailing list