[FFmpeg-devel] [FFmpeg-cvslog] avcodec/pgssubdec: Fix left shift of 255 by 24 places cannot be represented in type int

Michael Niedermayer michaelni at gmx.at
Sat Dec 5 03:22:03 CET 2015


On Sat, Dec 05, 2015 at 12:13:05AM +0100, Clément Bœsch wrote:
> On Fri, Dec 04, 2015 at 10:30:23PM +0100, Michael Niedermayer wrote:
> > ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Dec  4 21:38:12 2015 +0100| [4f2419888ba49245761f4ab343679c38e7880cfe] | committer: Michael Niedermayer
> > 
> > avcodec/pgssubdec: Fix left shift of 255 by 24 places cannot be represented in type int
> > 
> > Fixes: b293a6479bb4b5286cff24d356bfd955/asan_generic_225c3c9_7819_cc526b657450c6cdef1371b526499626.mkv
> > 
> > Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f2419888ba49245761f4ab343679c38e7880cfe
> > ---
> > 
> >  libavcodec/pgssubdec.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
> > index 61dc2ad..07a2a78 100644
> > --- a/libavcodec/pgssubdec.c
> > +++ b/libavcodec/pgssubdec.c
> > @@ -33,7 +33,7 @@
> >  #include "libavutil/imgutils.h"
> >  #include "libavutil/opt.h"
> >  
> > -#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
> > +#define RGBA(r,g,b,a) (((unsigned)(a) << 24) | ((r) << 16) | ((g) << 8) | (b))
> 
> I feel like I've seen this fix happen many times. And that specific cases
> is still lying around at least in 3 other places: windows2linux.h,
> libzvbi-teletextdec.c and texturedsp.c
> 
> Maybe it's time to refactor it with MK(BE)TAG etc? This macro is
> duplicated in like at least 4 files.

as you mention it, yes i too remember seeing this a few times already
not sure MK(BE)TAG is appropriate semantically though ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151205/1aaffcb8/attachment.sig>


More information about the ffmpeg-devel mailing list