aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-12-18 18:16:36 +0000
committerPaul B Mahol <onemda@gmail.com>2012-12-22 00:27:29 +0000
commit44fe118e0a5fc4797ee49e1ce56108bde13f19dc (patch)
treeec0de10b5105796d8c811300fff7daa9334c4042
parent6b50df6b3a11f04c4781bf8a94e5a5c879bb2352 (diff)
downloadffmpeg-44fe118e0a5fc4797ee49e1ce56108bde13f19dc.tar.gz
lavc/4xm: use bytestream2_get_bytes_left
Also replace relevant bytestream2 functions with unchecked variants due code that already checks for overreads. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/4xm.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index de5c9f53ee..2c2bc56b49 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -346,11 +346,11 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
av_assert2(code >= 0 && code <= 6);
if (code == 0) {
- if (f->g.buffer_end - f->g.buffer < 1) {
+ if (bytestream2_get_bytes_left(&f->g) < 1) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
return;
}
- src += f->mv[bytestream2_get_byte(&f->g)];
+ src += f->mv[bytestream2_get_byteu(&f->g)];
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
@@ -369,37 +369,37 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
} else if (code == 3 && f->version < 2) {
mcdc(dst, src, log2w, h, stride, 1, 0);
} else if (code == 4) {
- if (f->g.buffer_end - f->g.buffer < 1) {
+ if (bytestream2_get_bytes_left(&f->g) < 1) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
return;
}
- src += f->mv[bytestream2_get_byte(&f->g)];
+ src += f->mv[bytestream2_get_byteu(&f->g)];
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
- if (f->g2.buffer_end - f->g2.buffer < 1){
+ if (bytestream2_get_bytes_left(&f->g) < 2){
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
- mcdc(dst, src, log2w, h, stride, 1, bytestream2_get_le16(&f->g2));
+ mcdc(dst, src, log2w, h, stride, 1, bytestream2_get_le16u(&f->g2));
} else if (code == 5) {
- if (f->g2.buffer_end - f->g2.buffer < 1) {
+ if (bytestream2_get_bytes_left(&f->g) < 2) {
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
- mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2));
+ mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16u(&f->g2));
} else if (code == 6) {
- if (f->g2.buffer_end - f->g2.buffer < 2) {
+ if (bytestream2_get_bytes_left(&f->g) < 4) {
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
if (log2w) {
- dst[0] = bytestream2_get_le16(&f->g2);
- dst[1] = bytestream2_get_le16(&f->g2);
+ dst[0] = bytestream2_get_le16u(&f->g2);
+ dst[1] = bytestream2_get_le16u(&f->g2);
} else {
- dst[0] = bytestream2_get_le16(&f->g2);
- dst[stride] = bytestream2_get_le16(&f->g2);
+ dst[0] = bytestream2_get_le16u(&f->g2);
+ dst[stride] = bytestream2_get_le16u(&f->g2);
}
}
}