From: Dirk Farin Date: Mon, 16 Jul 2018 08:57:50 +0000 (+0200) Subject: [PATCH] check for negative Q-values in invalid input streams X-Git-Tag: archive/raspbian/1.0.3-1+rpi1+deb10u3^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b5a36dce5bde0604e1397dd037cb819a95896e4a;p=libde265.git [PATCH] check for negative Q-values in invalid input streams Gbp-Pq: Name check-4-negative-Q-value.patch --- diff --git a/libde265/transform.cc b/libde265/transform.cc index a844de2..ef404f8 100644 --- a/libde265/transform.cc +++ b/libde265/transform.cc @@ -147,6 +147,9 @@ void decode_quantization_parameters(thread_context* tctx, int xC,int yC, (52 + sps.QpBdOffset_Y)) - sps.QpBdOffset_Y; tctx->qPYPrime = QPY + sps.QpBdOffset_Y; + if (tctx->qPYPrime<0) { + tctx->qPYPrime=0; + } int qPiCb = Clip3(-sps.QpBdOffset_C,57, QPY+pps.pic_cb_qp_offset + shdr->slice_cb_qp_offset + tctx->CuQpOffsetCb); int qPiCr = Clip3(-sps.QpBdOffset_C,57, QPY+pps.pic_cr_qp_offset + shdr->slice_cr_qp_offset + tctx->CuQpOffsetCr); @@ -169,7 +172,14 @@ void decode_quantization_parameters(thread_context* tctx, int xC,int yC, //printf("q: %d %d\n",qPiCb, qPCb); tctx->qPCbPrime = qPCb + sps.QpBdOffset_C; + if (tctx->qPCbPrime<0) { + tctx->qPCbPrime = 0; + } + tctx->qPCrPrime = qPCr + sps.QpBdOffset_C; + if (tctx->qPCrPrime<0) { + tctx->qPCrPrime = 0; + } /* printf("Q: %d (%d %d %d / %d %d) %d %d %d\n",QPY,