[FFmpeg-devel] [PATCH 1/4] fftools/cmdutils: Fix undefined 1 << 31
Michael Niedermayer
michael at niedermayer.cc
Thu Nov 18 23:28:14 EET 2021
On Thu, Nov 18, 2021 at 09:15:05PM +0100, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > On Thu, Nov 18, 2021 at 10:07:36AM +0100, Andreas Rheinhardt wrote:
> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> >> ---
> >> fftools/cmdutils.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> >> index 594eeef379..f80c361eba 100644
> >> --- a/fftools/cmdutils.c
> >> +++ b/fftools/cmdutils.c
> >> @@ -1823,7 +1823,7 @@ int show_sample_fmts(void *optctx, const char *opt, const char *arg)
> >> int show_dispositions(void *optctx, const char *opt, const char *arg)
> >> {
> >> for (int i = 0; i < 32; i++) {
> >> - const char *str = av_disposition_to_string(1 << i);
> >> + const char *str = av_disposition_to_string(1U << i);
> >
> > is it intended to have 1U<<31 cast to int and then checked as in
> > if (disposition <= 0)
> > return NULL;
> >
> > ?
> >
>
> I agree that the types here (and also in ff_ctz (the relevant GCC
> builtins use unsigned types) are unfortunate and AVStream.disposition as
> well as the other types involved here should be unsigned. Shall I change
> av_disposition_to_string to unsigned and schedule AVStream.disposition
> to unsigned on the next bump? Or shall I just use "i < 31" above?
i have no strong preferrance, i see 20 ATM so a 31 limit seems fine
but if the type is changed because 31 is not enough, maybe we should
go to 64.
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is a danger to trust the dream we wish for rather than
the science we have, -- Dr. Kenneth Brown
-------------- 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/20211118/af049ebf/attachment.sig>
More information about the ffmpeg-devel
mailing list