Overreads can not happen as header size of 512 bytes is required.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
... | ... |
@@ -169,17 +169,17 @@ static int decode_frame(AVCodecContext *avctx, |
169 | 169 |
} |
170 | 170 |
|
171 | 171 |
/* Test for SGI magic. */ |
172 |
- if (bytestream2_get_be16(&s->g) != SGI_MAGIC) { |
|
172 |
+ if (bytestream2_get_be16u(&s->g) != SGI_MAGIC) { |
|
173 | 173 |
av_log(avctx, AV_LOG_ERROR, "bad magic number\n"); |
174 | 174 |
return AVERROR_INVALIDDATA; |
175 | 175 |
} |
176 | 176 |
|
177 |
- rle = bytestream2_get_byte(&s->g); |
|
178 |
- s->bytes_per_channel = bytestream2_get_byte(&s->g); |
|
179 |
- dimension = bytestream2_get_be16(&s->g); |
|
180 |
- s->width = bytestream2_get_be16(&s->g); |
|
181 |
- s->height = bytestream2_get_be16(&s->g); |
|
182 |
- s->depth = bytestream2_get_be16(&s->g); |
|
177 |
+ rle = bytestream2_get_byteu(&s->g); |
|
178 |
+ s->bytes_per_channel = bytestream2_get_byteu(&s->g); |
|
179 |
+ dimension = bytestream2_get_be16u(&s->g); |
|
180 |
+ s->width = bytestream2_get_be16u(&s->g); |
|
181 |
+ s->height = bytestream2_get_be16u(&s->g); |
|
182 |
+ s->depth = bytestream2_get_be16u(&s->g); |
|
183 | 183 |
|
184 | 184 |
if (s->bytes_per_channel != 1 && (s->bytes_per_channel != 2 || rle)) { |
185 | 185 |
av_log(avctx, AV_LOG_ERROR, "wrong channel number\n"); |