diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-07-31 12:37:05 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-08-02 18:31:59 +0200 |
commit | c7ff0c3e4b990ad1484a023a073394aaf5d8a261 (patch) | |
tree | 021148691c83970dfa1eb7b47944e2c14b91fc34 /libavcodec/sga.c | |
parent | 27a9e1ce2262f42b900e09f872f4b98e209b8842 (diff) | |
download | ffmpeg-c7ff0c3e4b990ad1484a023a073394aaf5d8a261.tar.gz |
avcodec/sga: Don't use GetBit-API for byte-aligned reads
Use the bytestream2-API instead.
Should also fix Coverity issue #1473536 (which is about an unchecked
init_get_bits8()).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/sga.c')
-rw-r--r-- | libavcodec/sga.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/sga.c b/libavcodec/sga.c index eae691adad..4ced6e9890 100644 --- a/libavcodec/sga.c +++ b/libavcodec/sga.c @@ -127,19 +127,18 @@ static int decode_index_palmap(SGAVideoContext *s, AVFrame *frame) static int decode_index_tilemap(SGAVideoContext *s, AVFrame *frame) { - GetByteContext *gb = &s->gb; - GetBitContext pm; + GetByteContext *gb = &s->gb, gb2; bytestream2_seek(gb, s->tilemapdata_offset, SEEK_SET); if (bytestream2_get_bytes_left(gb) < s->tilemapdata_size) return AVERROR_INVALIDDATA; - init_get_bits8(&pm, gb->buffer, s->tilemapdata_size); + gb2 = *gb; for (int y = 0; y < s->tiles_h; y++) { for (int x = 0; x < s->tiles_w; x++) { uint8_t tile[64]; - int tilemap = get_bits(&pm, 16); + int tilemap = bytestream2_get_be16u(&gb2); int flip_x = (tilemap >> 11) & 1; int flip_y = (tilemap >> 12) & 1; int tindex = av_clip((tilemap & 511) - 1, 0, s->nb_tiles - 1); |