[x265] [PATCH 3 of 4] Fix memory write beyond bound bug in intraPredAng8x8()

Min Chen chenm003 at 163.com
Wed Oct 23 14:10:37 CEST 2013


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1382530135 -28800
# Node ID f5f71d7f3bf383f2ac0545a5fecd4607a0a43f08
# Parent  a4450449aed7c4fbfad373118bf3ed9465a8bec9
Fix memory write beyond bound bug in intraPredAng8x8()

diff -r a4450449aed7 -r f5f71d7f3bf3 source/common/vec/intra-ssse3.cpp
--- a/source/common/vec/intra-ssse3.cpp	Wed Oct 23 20:08:37 2013 +0800
+++ b/source/common/vec/intra-ssse3.cpp	Wed Oct 23 20:08:55 2013 +0800
@@ -2482,14 +2482,14 @@
         {
             __m128i main = _mm_loadl_epi64((__m128i*)(refMain + 1));
 
-            _mm_storeu_si128((__m128i*)(dst), main);
-            _mm_storeu_si128((__m128i*)(dst + dstStride), main);
-            _mm_storeu_si128((__m128i*)(dst + 2 * dstStride), main);
-            _mm_storeu_si128((__m128i*)(dst + 3 * dstStride), main);
-            _mm_storeu_si128((__m128i*)(dst + 4 * dstStride), main);
-            _mm_storeu_si128((__m128i*)(dst + 5 * dstStride), main);
-            _mm_storeu_si128((__m128i*)(dst + 6 * dstStride), main);
-            _mm_storeu_si128((__m128i*)(dst + 7 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 0 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 1 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 2 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 3 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 4 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 5 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 6 * dstStride), main);
+            _mm_storel_epi64((__m128i*)(dst + 7 * dstStride), main);
 
             if (bFilter)
             {
@@ -2507,14 +2507,17 @@
                 row = _mm_add_epi16(row, side);
                 row = _mm_min_epi16(_mm_max_epi16(_mm_set1_epi16(0), row), _mm_set1_epi16((1 << X265_DEPTH) - 1));
 
-                dst[0 * dstStride] = _mm_extract_epi16(row, 0);
-                dst[1 * dstStride] = _mm_extract_epi16(row, 1);
-                dst[2 * dstStride] = _mm_extract_epi16(row, 2);
-                dst[3 * dstStride] = _mm_extract_epi16(row, 3);
-                dst[4 * dstStride] = _mm_extract_epi16(row, 4);
-                dst[5 * dstStride] = _mm_extract_epi16(row, 5);
-                dst[6 * dstStride] = _mm_extract_epi16(row, 6);
-                dst[7 * dstStride] = _mm_extract_epi16(row, 7);
+                uint8_t tmp[16];
+                _mm_storeu_si128((__m128i*)tmp, row);
+
+                dst[0 * dstStride] = tmp[ 0];
+                dst[1 * dstStride] = tmp[ 2];
+                dst[2 * dstStride] = tmp[ 4];
+                dst[3 * dstStride] = tmp[ 6];
+                dst[4 * dstStride] = tmp[ 8];
+                dst[5 * dstStride] = tmp[10];
+                dst[6 * dstStride] = tmp[12];
+                dst[7 * dstStride] = tmp[14];
             }
         }
     }



More information about the x265-devel mailing list