avcodec/exr: handle case when |im - IM| == 1 for huff compression
authorPaul B Mahol <onemda@gmail.com>
Sun, 28 Feb 2021 01:03:11 +0000 (02:03 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 28 Feb 2021 01:06:02 +0000 (02:06 +0100)
libavcodec/exr.c

index 5f99d9d5ab6d65142bad95c886a9b75dcc6e54f2..4559174ba261316eed26673f1c9f7d51703e6418 100644 (file)
@@ -420,6 +420,11 @@ static int huf_build_dec_table(EXRContext *s,
             td->run_sym = i;
     }
 
             td->run_sym = i;
     }
 
+    if (im > 0)
+        td->run_sym = 0;
+    else if (iM < 65535)
+        td->run_sym = 65535;
+
     if (td->run_sym == -1) {
         avpriv_request_sample(s->avctx, "No place for run symbol");
         return AVERROR_PATCHWELCOME;
     if (td->run_sym == -1) {
         avpriv_request_sample(s->avctx, "No place for run symbol");
         return AVERROR_PATCHWELCOME;