[x265] [PATCH 2 of 4] Fix for possible memory access violation in applyWeight()

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Tue Oct 8 13:41:22 CEST 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1381231327 -19800
#      Tue Oct 08 16:52:07 2013 +0530
# Node ID 70e6c0cd3f961f89b53106da3da7a28aaaddd63b
# Parent  b79ed7a252bba3cc293054c314287f722c8b3b3f
Fix for possible memory access violation in applyWeight()

diff -r b79ed7a252bb -r 70e6c0cd3f96 source/common/reference.cpp
--- a/source/common/reference.cpp	Tue Oct 08 16:44:13 2013 +0530
+++ b/source/common/reference.cpp	Tue Oct 08 16:52:07 2013 +0530
@@ -95,6 +95,7 @@
     int marginX = pic->m_lumaMarginX;
     int marginY = pic->m_lumaMarginY;
     pixel* src = (pixel*) pic->getLumaAddr() + (m_numWeightedRows * (int)g_maxCUHeight * lumaStride);
+    pixel* dst = fpelPlane + ((m_numWeightedRows * (int)g_maxCUHeight) * lumaStride);
     int width = pic->getWidth();
     int height = ((rows - m_numWeightedRows) * g_maxCUHeight);
     if (rows == numRows - 1)
@@ -105,10 +106,10 @@
     int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;
     shift = shift + shiftNum;
     round = shift ? (1 << (shift - 1)) : 0;
-    primitives.weightpUniPixel(src, fpelPlane, lumaStride, dstStride, width, height, weight, round, shift, offset);
+    primitives.weightpUniPixel(src, dst, lumaStride, dstStride, width, height, weight, round, shift, offset);
 
     // Extending Left & Right
-    primitives.extendRowBorder(fpelPlane, dstStride, width, height, marginX);
+    primitives.extendRowBorder(dst, dstStride, width, height, marginX);
 
     // Extending Above
     if (m_numWeightedRows == 0)


More information about the x265-devel mailing list