[FFmpeg-devel] [PATCH 2/2] avcodec/pnm: Avoid structure pointer dereferences in inner loop in pnm_get()

Michael Niedermayer michael at niedermayer.cc
Fri Feb 22 23:48:25 EET 2019


On Fri, Feb 22, 2019 at 09:10:55AM +0200, Lauri Kasanen wrote:
> On Thu, 21 Feb 2019 20:34:29 +0100
> Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > Improves speed from 5.4 to 4.2 seconds
> > Fixes: 13149/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGM_fuzzer-5760833622114304
> 
> LGTM

will apply


> 
> Though, I really would expect the compiler to detect and optimize that.
> I wonder if "PNMContext * const sc" would help it any.

i doubt that would help.
the char * pointer both the one we are reding from and the one we
write to could in principle alias anything else 
(this is allowed in C)

So the compiler would have to proof every time it writes to str/s that this
cannot alias anything in the structure. And every time it writes to the 
structure that it cannot alias the bytestream its reading from.
Otherwise it cannot optimize the operations out

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190222/372d1cad/attachment.sig>


More information about the ffmpeg-devel mailing list