shithub: dav1d

Download patch

ref: c71416582715945623f60f712260de168c878978
parent: 7b70548104e9c679fb6f8307acd4cf5b086a6afb
author: Luc Trudeau <[email protected]>
date: Mon Sep 24 14:35:09 EDT 2018

Fix undefined-behavior in obu.c

Removes undefined-behavior when primary_ref_frame is 7

--- a/src/obu.c
+++ b/src/obu.c
@@ -590,10 +590,14 @@
                     hdr->segmentation.seg_data.preskip = 1;
                 }
             }
+        } else if (hdr->primary_ref_frame == PRIMARY_REF_NONE) {
+            memset(&hdr->segmentation.seg_data, 0, sizeof(Av1SegmentationDataSet));
         } else {
             const int pri_ref = hdr->refidx[hdr->primary_ref_frame];
             hdr->segmentation.seg_data = c->refs[pri_ref].seg_data;
         }
+    } else if (hdr->primary_ref_frame == PRIMARY_REF_NONE) {
+        memset(&hdr->segmentation.seg_data, 0, sizeof(Av1SegmentationDataSet));
     } else {
         const int pri_ref = hdr->refidx[hdr->primary_ref_frame];
         hdr->segmentation.seg_data = c->refs[pri_ref].seg_data;