[FFmpeg-devel] [PATCH 1/3] avcodec/h2645_parse: Limit initial skipped_bytes_pos_size to nal size / 16

Michael Niedermayer michael at niedermayer.cc
Sun Oct 4 23:57:36 EEST 2020


On Sun, Oct 04, 2020 at 05:04:05PM -0300, James Almer wrote:
> On 10/4/2020 4:41 PM, Michael Niedermayer wrote:
> > Fixes: OOM
> > Fixes: 23817/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-6300869057576960
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/h2645_parse.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
> > index 0f98b49fbe..61105a6eb5 100644
> > --- a/libavcodec/h2645_parse.c
> > +++ b/libavcodec/h2645_parse.c
> > @@ -467,7 +467,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
> >              memset(pkt->nals + pkt->nals_allocated, 0, sizeof(*pkt->nals));
> >  
> >              nal = &pkt->nals[pkt->nb_nals];
> > -            nal->skipped_bytes_pos_size = 1024; // initial buffer size
> > +            nal->skipped_bytes_pos_size = FFMIN(1024, 1+(extract_length>>4)); // initial buffer size
> 
> Why is there even an initial buffer? Why not just let
> ff_h2645_extract_rbsp() allocate it when needed?

i wondered that too and assumed it was done that way to avoid spending
cpu cycles on reallocations later



[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201004/d34a596d/attachment.sig>


More information about the ffmpeg-devel mailing list