aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/bytestream.h
diff options
context:
space:
mode:
authorAneesh Dogra <lionaneesh@gmail.com>2012-01-13 23:05:57 +0530
committerJustin Ruggles <justin.ruggles@gmail.com>2012-01-14 12:35:53 -0500
commit4cd0bdae9a62d1f0366e60603222762af31e5289 (patch)
treef70981a4f5f77bd561ea265adff4405f4ed08706 /libavcodec/bytestream.h
parente44c11e9fa505da3c54738ae2d21123338a28ca6 (diff)
downloadffmpeg-4cd0bdae9a62d1f0366e60603222762af31e5289.tar.gz
sgidec: Use bytestream2 functions to prevent buffer overreads.
The patch also adds several bytestream macros to deal with native endian. Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavcodec/bytestream.h')
-rw-r--r--libavcodec/bytestream.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
index 9ec74cf9a7..503598a4bc 100644
--- a/libavcodec/bytestream.h
+++ b/libavcodec/bytestream.h
@@ -75,6 +75,42 @@ DEF (byte, 1, AV_RB8 , AV_WB8 )
#undef DEF64
#undef DEF_T
+#if HAVE_BIGENDIAN
+# define bytestream2_get_ne16 bytestream2_get_be16
+# define bytestream2_get_ne24 bytestream2_get_be24
+# define bytestream2_get_ne32 bytestream2_get_be32
+# define bytestream2_get_ne64 bytestream2_get_be64
+# define bytestream2_get_ne16u bytestream2_get_be16u
+# define bytestream2_get_ne24u bytestream2_get_be24u
+# define bytestream2_get_ne32u bytestream2_get_be32u
+# define bytestream2_get_ne64u bytestream2_get_be64u
+# define bytestream2_put_ne16 bytestream2_put_be16
+# define bytestream2_put_ne24 bytestream2_put_be24
+# define bytestream2_put_ne32 bytestream2_put_be32
+# define bytestream2_put_ne64 bytestream2_put_be64
+# define bytestream2_peek_ne16 bytestream2_peek_be16
+# define bytestream2_peek_ne24 bytestream2_peek_be24
+# define bytestream2_peek_ne32 bytestream2_peek_be32
+# define bytestream2_peek_ne64 bytestream2_peek_be64
+#else
+# define bytestream2_get_ne16 bytestream2_get_le16
+# define bytestream2_get_ne24 bytestream2_get_le24
+# define bytestream2_get_ne32 bytestream2_get_le32
+# define bytestream2_get_ne64 bytestream2_get_le64
+# define bytestream2_get_ne16u bytestream2_get_le16u
+# define bytestream2_get_ne24u bytestream2_get_le24u
+# define bytestream2_get_ne32u bytestream2_get_le32u
+# define bytestream2_get_ne64u bytestream2_get_le64u
+# define bytestream2_put_ne16 bytestream2_put_le16
+# define bytestream2_put_ne24 bytestream2_put_le24
+# define bytestream2_put_ne32 bytestream2_put_le32
+# define bytestream2_put_ne64 bytestream2_put_le64
+# define bytestream2_peek_ne16 bytestream2_peek_le16
+# define bytestream2_peek_ne24 bytestream2_peek_le24
+# define bytestream2_peek_ne32 bytestream2_peek_le32
+# define bytestream2_peek_ne64 bytestream2_peek_le64
+#endif
+
static av_always_inline void bytestream2_init(GetByteContext *g,
const uint8_t *buf, int buf_size)
{