Hi,
On Sun, Dec 18, 2011 at 11:22 AM, Aneesh Dogra <[email protected]> wrote:
> Add checks for over reading in the Bytestream API.
> ---
> libavcodec/4xm.c | 20 ++++++--------------
> libavcodec/bytestream.h | 34 +++++++++++++++++++++++++++++++++-
> 2 files changed, 39 insertions(+), 15 deletions(-)
>
General concept is OK. Small comments:
@@ -132,7 +132,6 @@ typedef struct FourXContext{
>
[..]
> AVFrame current_picture, last_picture;
> GetBitContext pre_gb; ///< ac/dc prefix
> GetBitContext gb;
> - const uint8_t *bytestream;
> const uint16_t *wordstream;
> int mv[256];
> VLC pre_vlc;
> @@ -142,6 +141,7 @@ typedef struct FourXContext{
> unsigned int bitstream_buffer_size;
> int version;
> CFrameBuffer cfrm[CFRAME_BUFFER_COUNT];
> + GetByteContext g;
> } FourXContext;
>
You can just add g in the same place where "const uint8_t * bytestream;
was. Also, note how overflows are still possible in this decoder because of
"wordstream", you should replace those also. For that, you need to add
another function to bytestream2 that returns a uin16_t.
> diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
>
[..]
> @@ -61,7 +94,6 @@ static av_always_inline unsigned int
> bytestream_get_buffer(const uint8_t **b, ui
> (*b) += size;
> return size;
> }
> -
> static av_always_inline void bytestream_put_buffer(uint8_t **b, const
> uint8_t *src, unsigned int size)
> {
> memcpy(*b, src, size);
>
Cosmetic change, please revert this piece.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel