Skip to content
Snippets Groups Projects
Commit 6c7d1608 authored by Paul B Mahol's avatar Paul B Mahol
Browse files

sgidec: use unchecked bytestream2 functions where it makes sense


Overreads can not happen as header size of 512 bytes is required.

Signed-off-by: default avatarPaul B Mahol <onemda@gmail.com>
parent dc666d36
No related branches found
No related tags found
No related merge requests found
...@@ -169,17 +169,17 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -169,17 +169,17 @@ static int decode_frame(AVCodecContext *avctx,
} }
/* Test for SGI magic. */ /* Test for SGI magic. */
if (bytestream2_get_be16(&s->g) != SGI_MAGIC) { if (bytestream2_get_be16u(&s->g) != SGI_MAGIC) {
av_log(avctx, AV_LOG_ERROR, "bad magic number\n"); av_log(avctx, AV_LOG_ERROR, "bad magic number\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
rle = bytestream2_get_byte(&s->g); rle = bytestream2_get_byteu(&s->g);
s->bytes_per_channel = bytestream2_get_byte(&s->g); s->bytes_per_channel = bytestream2_get_byteu(&s->g);
dimension = bytestream2_get_be16(&s->g); dimension = bytestream2_get_be16u(&s->g);
s->width = bytestream2_get_be16(&s->g); s->width = bytestream2_get_be16u(&s->g);
s->height = bytestream2_get_be16(&s->g); s->height = bytestream2_get_be16u(&s->g);
s->depth = bytestream2_get_be16(&s->g); s->depth = bytestream2_get_be16u(&s->g);
if (s->bytes_per_channel != 1 && (s->bytes_per_channel != 2 || rle)) { if (s->bytes_per_channel != 1 && (s->bytes_per_channel != 2 || rle)) {
av_log(avctx, AV_LOG_ERROR, "wrong channel number\n"); av_log(avctx, AV_LOG_ERROR, "wrong channel number\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment