Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: src/opts/SkBitmapFilter_opts_SSE2.cpp

Issue 1187173005: Plumb through out_row byte length so we can assert we stay underneath it. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/opts/SkBitmapFilter_opts_SSE2.h ('k') | src/opts/SkBitmapProcState_arm_neon.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkBitmapFilter_opts_SSE2.cpp
diff --git a/src/opts/SkBitmapFilter_opts_SSE2.cpp b/src/opts/SkBitmapFilter_opts_SSE2.cpp
index de3dd3b8e9e04161b642c12d27412719a600d90c..ecaad23d76f1069eee17329424fd0446b0c352b0 100644
--- a/src/opts/SkBitmapFilter_opts_SSE2.cpp
+++ b/src/opts/SkBitmapFilter_opts_SSE2.cpp
@@ -174,7 +174,10 @@ void convolveHorizontally_SSE2(const unsigned char* src_data,
// refer to that function for detailed comments.
void convolve4RowsHorizontally_SSE2(const unsigned char* src_data[4],
const SkConvolutionFilter1D& filter,
- unsigned char* out_row[4]) {
+ unsigned char* out_row[4],
+ size_t outRowBytes) {
+ SkDEBUGCODE(const unsigned char* out_row_0_start = out_row[0];)
+
int num_values = filter.numValues();
int filter_offset, filter_length;
@@ -275,6 +278,9 @@ void convolve4RowsHorizontally_SSE2(const unsigned char* src_data[4],
accum3 = _mm_packs_epi32(accum3, zero);
accum3 = _mm_packus_epi16(accum3, zero);
+ // We seem to be running off the edge here (chromium:491660).
+ SkASSERT(((size_t)out_row[0] - (size_t)out_row_0_start) < outRowBytes);
+
*(reinterpret_cast<int*>(out_row[0])) = _mm_cvtsi128_si32(accum0);
*(reinterpret_cast<int*>(out_row[1])) = _mm_cvtsi128_si32(accum1);
*(reinterpret_cast<int*>(out_row[2])) = _mm_cvtsi128_si32(accum2);
« no previous file with comments | « src/opts/SkBitmapFilter_opts_SSE2.h ('k') | src/opts/SkBitmapProcState_arm_neon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698