On Sun, Apr 05, 2020 at 04:13:28PM +0530, gautamr...@gmail.com wrote: > From: Gautam Ramakrishnan <gautamr...@gmail.com> > > This patch adds functional changes to support the > PPT marker. This patch fixes bug ticket #4610. > --- > libavcodec/jpeg2000dec.c | 88 +++++++++++++++++++++++++++++++++++----- > 1 file changed, 77 insertions(+), 11 deletions(-) > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c > index 732d88e6fc..2af3c61c37 100644 > --- a/libavcodec/jpeg2000dec.c > +++ b/libavcodec/jpeg2000dec.c > @@ -83,6 +83,10 @@ typedef struct Jpeg2000Tile { > Jpeg2000QuantStyle qntsty[4]; > Jpeg2000POC poc; > Jpeg2000TilePart tile_part[32]; > + uint8_t has_ppt; // whether this tile has a > ppt marker > + uint8_t *packed_headers; // contains packed headers. > Used only along with PPT marker > + int packed_headers_size; // size in bytes of the > packed headers > + GetByteContext packed_headers_stream; // byte context > corresponding to packed headers > uint16_t tp_idx; // Tile-part index > int coord[2][2]; // border coordinates {{x0, x1}, > {y0, y1}} > } Jpeg2000Tile; > @@ -855,6 +859,37 @@ static int get_plt(Jpeg2000DecoderContext *s, int n) > return 0; > } > > +static int get_ppt(Jpeg2000DecoderContext *s, int n) > +{ > + Jpeg2000Tile *tile; > + > + if (s->curtileno < 0) > + return AVERROR_INVALIDDATA; > + > + tile = &s->tile[s->curtileno]; > + if (tile->tp_idx != 0) { > + av_log(s->avctx, AV_LOG_ERROR, > + "PPT marker can occur only on first tile part of a tile.\n"); > + return AVERROR_INVALIDDATA; > + } > + > + tile->has_ppt = 1; // this tile has a ppt marker > + bytestream2_get_byte(&s->g); // Zppt is skipped and not used
> + if (!tile->packed_headers) > + tile->packed_headers = av_malloc(n - 3); > + else > + tile->packed_headers = av_realloc(tile->packed_headers, > + tile->packed_headers_size + n - 3); why is the special case with av_malloc() needed ? > + if (!tile->packed_headers) > + return AVERROR(ENOMEM); this is looks like a memleak as the original array has been overwritten but not deallocated thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".