va: h265dec: Fix a temp var overflow bug when write pred weight table.
authorHe Junyan <junyan.he@intel.com>
Thu, 15 Jul 2021 13:32:54 +0000 (21:32 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 15 Jul 2021 14:25:09 +0000 (14:25 +0000)
The temp guint8 var of delta_chroma_offset_l0 and delta_chroma_offset_l1
can not cover the full range of delta_chroma_weight_l0/1 in the slice
header. When overflow happens, the decoder result is wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2412>

sys/va/gstvah265dec.c

index 880edd6..c126e5a 100644 (file)
@@ -381,7 +381,7 @@ _fill_pred_weight_table (GstVaH265Dec * self, GstH265SliceHdr * header,
       continue;
 
     for (j = 0; j < 2; j++) {
-      gint8 delta_chroma_offset_l0 =
+      gint16 delta_chroma_offset_l0 =
           header->pred_weight_table.delta_chroma_offset_l0[i][j];
       gint chroma_offset;
 
@@ -430,7 +430,7 @@ _fill_pred_weight_table (GstVaH265Dec * self, GstH265SliceHdr * header,
       continue;
 
     for (j = 0; j < 2; j++) {
-      gint8 delta_chroma_offset_l1 =
+      gint16 delta_chroma_offset_l1 =
           header->pred_weight_table.delta_chroma_offset_l1[i][j];
       gint chroma_offset;