Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-15 01:19:14 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2020-03-06 02:58:31 +0300
commit7f96325bc4ccdcb4767bd6d11591d1e66f1350f4 (patch)
treeaad8543c20b0de83496fc5db1ed775419e69e5f5 /libavcodec/bytestream.h
parenta2e4879432b9de6aa899b85aebbc0eb6a8b5f37f (diff)
bytestream: Make get_bytes_left compatible with overread
bytestream2_get_bytes_left returns an unsigned int; as a result, it returns big positive numbers if an overread already happened, making it unsuitable for scenarios where one wants to allow this in a controlled way (because the buffer is actually padded so that no segfaults can happen). So change it to return an ordinary int. Also, bytestream2_get_bytes_left_p has been modified in the same way. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/bytestream.h')
-rw-r--r--libavcodec/bytestream.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
index 7be7fc22fc..0516a6e3dc 100644
--- a/libavcodec/bytestream.h
+++ b/libavcodec/bytestream.h
@@ -151,12 +151,12 @@ static av_always_inline void bytestream2_init_writer(PutByteContext *p,
p->eof = 0;
}
-static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
+static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
{
return g->buffer_end - g->buffer;
}
-static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p)
+static av_always_inline int bytestream2_get_bytes_left_p(PutByteContext *p)
{
return p->buffer_end - p->buffer;
}