Commit c17dd513 authored by Michael Niedermayer's avatar Michael Niedermayer

bytestream2_init: assert that buf_size is valid

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 32fc8d6d
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
...@@ -131,6 +132,7 @@ static av_always_inline void bytestream2_init(GetByteContext *g, ...@@ -131,6 +132,7 @@ static av_always_inline void bytestream2_init(GetByteContext *g,
const uint8_t *buf, const uint8_t *buf,
int buf_size) int buf_size)
{ {
av_assert0(buf_size >= 0);
g->buffer = buf; g->buffer = buf;
g->buffer_start = buf; g->buffer_start = buf;
g->buffer_end = buf + buf_size; g->buffer_end = buf + buf_size;
...@@ -140,6 +142,7 @@ static av_always_inline void bytestream2_init_writer(PutByteContext *p, ...@@ -140,6 +142,7 @@ static av_always_inline void bytestream2_init_writer(PutByteContext *p,
uint8_t *buf, uint8_t *buf,
int buf_size) int buf_size)
{ {
av_assert0(buf_size >= 0);
p->buffer = buf; p->buffer = buf;
p->buffer_start = buf; p->buffer_start = buf;
p->buffer_end = buf + buf_size; p->buffer_end = buf + buf_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment