[FFmpeg-cvslog] lavc/jpeg2000dec: Support reading 64-bit atom size.
Carl Eugen Hoyos
git at videolan.org
Thu Dec 28 04:02:02 EET 2017
ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Wed Dec 27 23:18:58 2017 +0100| [658bdc67715b3fbf75f92c7a459272149e3859df] | committer: Carl Eugen Hoyos
lavc/jpeg2000dec: Support reading 64-bit atom size.
Fixes ticket #6935.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=658bdc67715b3fbf75f92c7a459272149e3859df
---
libavcodec/jpeg2000dec.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 8071dc3c84..01fe4b3949 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2009,7 +2009,16 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
bytestream2_get_bytes_left(&s->g) >= 8) {
atom_size = bytestream2_get_be32u(&s->g);
atom = bytestream2_get_be32u(&s->g);
- atom_end = bytestream2_tell(&s->g) + atom_size - 8;
+ if (atom_size == 1) {
+ if (bytestream2_get_be32u(&s->g)) {
+ avpriv_request_sample(s->avctx, "Huge atom");
+ return 0;
+ }
+ atom_size = bytestream2_get_be32u(&s->g);
+ atom_end = bytestream2_tell(&s->g) + atom_size - 16;
+ } else {
+ atom_end = bytestream2_tell(&s->g) + atom_size - 8;
+ }
if (atom == JP2_CODESTREAM)
return 1;
More information about the ffmpeg-cvslog
mailing list