[FFmpeg-devel] avcodec/get_bits: Document skip_bits_long()

Submitted by Michael Niedermayer on March 23, 2018, 7:20 p.m.

Details

Message ID 20180323192035.8284-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer March 23, 2018, 7:20 p.m.
Found-by: Kieran
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/get_bits.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Thilo Borgmann March 23, 2018, 9:02 p.m.
Am 23.03.18 um 20:20 schrieb Michael Niedermayer:
> Found-by: Kieran
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/get_bits.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
> index 0c7f5ff0c6..3ec45e7ab6 100644
> --- a/libavcodec/get_bits.h
> +++ b/libavcodec/get_bits.h
> @@ -201,6 +201,13 @@ static inline int get_bits_count(const GetBitContext *s)
>      return s->index;
>  }
>  
> +/**
> + * Skips the specified number of bits.
> + * @param n the number of bits to skip,
> + *          For the UNCHECKED_BITSTREAM_READER this must not cause the distance
> + *          from the start to overflow int32_t. Staying within the bitstream + padding
> + *          is sufficient too.
                  ^^^^^^^^^^
Shouldn't this be "required" or "necessary"?
And nit: "something, too."


-Thilo
Michael Niedermayer March 24, 2018, 12:37 a.m.
On Fri, Mar 23, 2018 at 10:02:39PM +0100, Thilo Borgmann wrote:
> Am 23.03.18 um 20:20 schrieb Michael Niedermayer:
> > Found-by: Kieran
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/get_bits.h | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
> > index 0c7f5ff0c6..3ec45e7ab6 100644
> > --- a/libavcodec/get_bits.h
> > +++ b/libavcodec/get_bits.h
> > @@ -201,6 +201,13 @@ static inline int get_bits_count(const GetBitContext *s)
> >      return s->index;
> >  }
> >  
> > +/**
> > + * Skips the specified number of bits.
> > + * @param n the number of bits to skip,
> > + *          For the UNCHECKED_BITSTREAM_READER this must not cause the distance
> > + *          from the start to overflow int32_t. Staying within the bitstream + padding
> > + *          is sufficient too.
>                   ^^^^^^^^^^
> Shouldn't this be "required" or "necessary"?

The bitstream reader must be able to index the whole bitstream and the padding
otherwise it would have some issues, actually it possibly does have a bug there
i need to double check this

currently it uses int32, so if the input is bigger the reader will reject this
so just staying within that size should be fine
that is unless iam missing something

[...]


> And nit: "something, too."

will fix

[...]
Michael Niedermayer March 26, 2018, 12:12 a.m.
apparently i failed to send this reply after writing it

On Fri, Mar 23, 2018 at 10:02:39PM +0100, Thilo Borgmann wrote:
> Am 23.03.18 um 20:20 schrieb Michael Niedermayer:
> > Found-by: Kieran
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/get_bits.h | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
> > index 0c7f5ff0c6..3ec45e7ab6 100644
> > --- a/libavcodec/get_bits.h
> > +++ b/libavcodec/get_bits.h
> > @@ -201,6 +201,13 @@ static inline int get_bits_count(const GetBitContext *s)
> >      return s->index;
> >  }
> >  
> > +/**
> > + * Skips the specified number of bits.
> > + * @param n the number of bits to skip,
> > + *          For the UNCHECKED_BITSTREAM_READER this must not cause the distance
> > + *          from the start to overflow int32_t. Staying within the bitstream + padding
> > + *          is sufficient too.
>                   ^^^^^^^^^^
> Shouldn't this be "required" or "necessary"?

The bitstream reader must be able to index the whole bitstream and the padding
otherwise it would have some issues, actually it possibly does have a bug there
i need to double check this

currently it uses int32, so if the input is bigger the reader will reject this
so just staying within that size should be fine
that is unless iam missing something

[...]


> And nit: "something, too."

will fix

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 0c7f5ff0c6..3ec45e7ab6 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -201,6 +201,13 @@  static inline int get_bits_count(const GetBitContext *s)
     return s->index;
 }
 
+/**
+ * Skips the specified number of bits.
+ * @param n the number of bits to skip,
+ *          For the UNCHECKED_BITSTREAM_READER this must not cause the distance
+ *          from the start to overflow int32_t. Staying within the bitstream + padding
+ *          is sufficient too.
+ */
 static inline void skip_bits_long(GetBitContext *s, int n)
 {
 #if UNCHECKED_BITSTREAM_READER