init_get_bits(&gbit, gb->buffer, nbits);
while (get_bits_left(&gbit) > 0 && oe < no) {
- uint16_t x = get_vlc2(&gbit, vlc->table, 12, 2);
+ uint16_t x = get_vlc2(&gbit, vlc->table, 12, 3);
if (x == run_sym) {
int run = get_bits(&gbit, 8);
- uint16_t fill = out[oe - 1];
+ uint16_t fill;
+
+ if (oe == 0 || oe + run > no)
+ return AVERROR_INVALIDDATA;
+
+ fill = out[oe - 1];
while (run-- > 0)
out[oe++] = fill;
// allocate thread data, used for non EXR_RAW compression types
s->thread_data = av_mallocz_array(avctx->thread_count, sizeof(EXRThreadData));
if (!s->thread_data)
- return AVERROR_INVALIDDATA;
+ return AVERROR(ENOMEM);
return 0;
}
.version = LIBAVUTIL_VERSION_INT,
};
-AVCodec ff_exr_decoder = {
+const AVCodec ff_exr_decoder = {
.name = "exr",
.long_name = NULL_IF_CONFIG_SMALL("OpenEXR image"),
.type = AVMEDIA_TYPE_VIDEO,