[FFmpeg-devel] Array bug in aes.c
Michael Niedermayer
michaelni
Fri Jan 18 13:25:23 CET 2008
On Fri, Jan 18, 2008 at 06:12:16AM +0100, Serge van den Boom wrote:
> On Jan 17, 2008, at 9:21 PM, Michael Niedermayer wrote:
> > On Thu, Jan 17, 2008 at 02:16:19PM -0800, Mike Melanson wrote:
> >> This comes from my blog's comments:
> >> http://multimedia.cx/eggs/up-to-date-gcc/#comment-92872
> >>
> >> ================
> >> Well, at least one of those warnings is an actual bug:
> >> /tmp/fate/source/libavutil/aes.c:133: warning: array subscript is above
> >> array bounds
> >>
> >> In aes.c:133:
> >> if(!enc_multbl[0][sizeof(enc_multbl)/sizeof(enc_multbl[0][0])-1]){
> >>
> >
> >> I take it this was meant:
> >> if(!enc_multbl[0][sizeof(enc_multbl[0])/sizeof(enc_multbl[0][0])-1]){
> >
> > no, this would then be an actual bug
> >
> > how does one disable these warnings?
[...]
> I guess you could cast enc_multbl first:
> ((uint32_t *) enc_multbl)[sizeof(enc_multbl)/sizeof(enc_multbl[0][0]) - 1]
> or
> *((uint32_t *) (&enc_multbl + 1) - 1)
using of uint32_t is fragile as that would break if the type changes
>
> But if you mean "last element of the last element of enc_multbl", why not
> write that?
> enc_multbl[sizeof(enc_multbl) / sizeof(enc_multbl[0]) - 1][
> sizeof(enc_multbl[0]) / sizeof(enc_multbl[0][0]) - 1]
bloated mess ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080118/a58b0277/attachment.pgp>
More information about the ffmpeg-devel
mailing list