[x265] [PATCH] common: validate "bframe" and "maxCUSize" for positive values

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Fri Feb 21 08:00:09 CET 2014


# HG changeset patch
# User Sumalatha Polureddy
# Date 1392966000 -19800
# Node ID 00faf694d2feefbe49a8d91ac4afaada93cab53c
# Parent  0c19c44af2d3a8825d804597f1c2f82e32e4d4b7
common: validate "bframe" and "maxCUSize" for positive values

diff -r 0c19c44af2d3 -r 00faf694d2fe source/common/common.cpp
--- a/source/common/common.cpp	Fri Feb 21 12:23:22 2014 +0900
+++ b/source/common/common.cpp	Fri Feb 21 12:30:00 2014 +0530
@@ -460,6 +460,10 @@
 {
 #define CHECK(expr, msg) check_failed |= _confirm(param, expr, msg)
     int check_failed = 0; /* abort if there is a fatal configuration problem */
+    CHECK(param->maxCUSize > 2147483648/*2^31*/,
+          "maximum CU size should positive number");
+    if (check_failed == 1)
+        return check_failed;// return if maxCUSize is negative, since maxcusize is used in below code for accessing an array which should be positive
     uint32_t maxCUDepth = (uint32_t)g_convertToBit[param->maxCUSize];
     uint32_t tuQTMaxLog2Size = maxCUDepth + 2 - 1;
     uint32_t tuQTMinLog2Size = 2; //log2(4)
@@ -530,6 +534,8 @@
           "RD Level is out of range");
     CHECK(param->bframes > param->lookaheadDepth,
           "Lookahead depth must be greater than the max consecutive bframe count");
+    CHECK(param->bframes < 0,
+          "bframe count should be greater than zero");
     CHECK(param->bframes > X265_BFRAME_MAX,
           "max consecutive bframe count must be 16 or smaller");
     CHECK(param->lookaheadDepth > X265_LOOKAHEAD_MAX,


More information about the x265-devel mailing list