[FFmpeg-devel] [PATCH] avcodec/videodsp_template: Fix overflow of addition

Michael Niedermayer michael at niedermayer.cc
Wed Jun 26 22:41:03 EEST 2019


On Fri, Jun 21, 2019 at 09:07:38AM +0200, Reimar Döffinger wrote:
> 
> 
> On 18.06.2019, at 16:25, Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > Fixes: addition of unsigned offset to 0x7f56fc26a9b6 overflowed to 0x7f56fc26a8be*
> > Fixes: clusterfuzz-testcase-minimized-mediasource_MP4_AVC1_pipeline_integration_fuzzer-4917949056679936
> > 
> > Reported-by: Matt Wolenetz <wolenetz at google.com>
> > Reviewed-by: Matt Wolenetz <wolenetz at google.com>
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> > libavcodec/videodsp_template.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c
> > index 94c1b7188d..eae2f1d51b 100644
> > --- a/libavcodec/videodsp_template.c
> > +++ b/libavcodec/videodsp_template.c
> > @@ -44,7 +44,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src,
> >         src_y = 1 - block_h;
> >     }
> >     if (src_x >= w) {
> > -        src  += (w - 1 - src_x) * sizeof(pixel);
> > +        src  -= (1 + src_x - w) * sizeof(pixel);
> 
> This is really non-obvious and someone might be tempted to "simplify", especially since the old way matched the code a few lines below.
> I'd suggest adding a comment.

will apply with a comment

thanks


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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- 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/20190626/981a37f5/attachment.sig>


More information about the ffmpeg-devel mailing list