- avctx->execute(avctx, decode_subband_golomb, bands, NULL, num_bands, sizeof(SubBand*));
+ avctx->execute(avctx, decode_subband_golomb, bands, ret, num_bands, sizeof(SubBand*));
+
+ for (i = 0; i < s->wavelet_depth * 3 + 1; i++) {
+ if (ret[i] < 0)
+ damaged_count++;
+ }
+ if (damaged_count > (s->wavelet_depth * 3 + 1) /2)
+ return AVERROR_INVALIDDATA;
+
+ return 0;