History

Avoid writing in array index [-1] in DecUT_IntraPrediction

This fixes running the tests when built with clang in debug mode. This was accidentally broken in 6e815e708 when switched to using ENFORCE_STACK_ALIGN_1D instead of manually aligning the buffers. Previously the aligned pointer always had at least 16 bytes of extra space in the stack before the pointer, so using [-1] was ok, while now when using ENFORCE_STACK_ALIGN_1D, it's only guaranteed that the pointer itself is aligned, but not that there's any extra space before the pointer. Therefore, we need to manually offset everything by one kiStride extra. (This already was accounted for in the total number of bytes allocated for the array.)

Martin Storsjö committed 12 years ago

Commit 292d78d1 parent ba7dca81 file · +10 −10Browse files

Showing the changes to test/decoder/DecUT_IntraPrediction.cpp (1 of 1 file). Show all

Unified · Split

test/decoder/DecUT_IntraPrediction.cpp+10−10
@@ -391,15 +391,15 @@ if (ASM) { \ · 390 unmodified lines
391} \391} \
392while(iRunTimes--) {\392while(iRunTimes--) {\
393for (int i = 0; i < 17; i ++) {\393for (int i = 0; i < 17; i ++) {\
394 pRefBuffer[i] = pPredBuffer[i] = rand() & 255; \394 pRefBuffer[kiStride + i] = pPredBuffer[kiStride + i] = rand() & 255; \
395 pRefBuffer[i * kiStride - 1] = pPredBuffer[i * kiStride - 1] = rand() & 255; \395 pRefBuffer[(i+1) * kiStride - 1] = pPredBuffer[(i+1) * kiStride - 1] = rand() & 255; \
396}\396}\
397pred(&pPredBuffer[kiStride], kiStride); \397pred(&pPredBuffer[2*kiStride], kiStride); \
398ref(&pRefBuffer[kiStride], kiStride); \398ref(&pRefBuffer[2*kiStride], kiStride); \
399bool ok = true; \399bool ok = true; \
400for (int i = 0; i < 8; i ++)\400for (int i = 0; i < 8; i ++)\
401 for(int j = 0; j < 8; j ++)\401 for(int j = 0; j < 8; j ++)\
402 if (pPredBuffer[(i+1) * kiStride + j] != pRefBuffer[(i+1) * kiStride + j]) {\402 if (pPredBuffer[(i+2) * kiStride + j] != pRefBuffer[(i+2) * kiStride + j]) {\
403 ok = false; \403 ok = false; \
404 break; \404 break; \
405 } \405 } \
@@ -528,15 +528,15 @@ if (ASM) { \ · 122 unmodified lines
528}\528}\
529while(iRunTimes--) {\529while(iRunTimes--) {\
530for (int i = 0; i < 17; i ++) {\530for (int i = 0; i < 17; i ++) {\
531 pRefBuffer[i] = pPredBuffer[i] = rand() & 255; \531 pRefBuffer[kiStride + i] = pPredBuffer[kiStride + i] = rand() & 255; \
532 pRefBuffer[i * kiStride - 1] = pPredBuffer[i * kiStride - 1] = rand() & 255; \532 pRefBuffer[(i+1) * kiStride - 1] = pPredBuffer[(i+1) * kiStride - 1] = rand() & 255; \
533}\533}\
534pred(&pPredBuffer[kiStride], kiStride); \534pred(&pPredBuffer[2*kiStride], kiStride); \
535ref(&pRefBuffer[kiStride], kiStride); \535ref(&pRefBuffer[2*kiStride], kiStride); \
536bool ok = true; \536bool ok = true; \
537for (int i = 0; i < 16; i ++)\537for (int i = 0; i < 16; i ++)\
538 for(int j = 0; j < 16; j ++)\538 for(int j = 0; j < 16; j ++)\
539 if (pPredBuffer[(i+1) * kiStride + j] != pRefBuffer[(i+1) * kiStride + j]) {\539 if (pPredBuffer[(i+2) * kiStride + j] != pRefBuffer[(i+2) * kiStride + j]) {\
540 ok = false; \540 ok = false; \
541 break; \541 break; \
542 } \542 } \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t