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
391391 } \
392392 while(iRunTimes--) {\
393393 for (int i = 0; i < 17; i ++) {\
394− pRefBuffer[i] = pPredBuffer[i] = rand() & 255; \
395− pRefBuffer[i * kiStride - 1] = pPredBuffer[i * kiStride - 1] = rand() & 255; \
394+ pRefBuffer[kiStride + i] = pPredBuffer[kiStride + i] = rand() & 255; \
395+ pRefBuffer[(i+1) * kiStride - 1] = pPredBuffer[(i+1) * kiStride - 1] = rand() & 255; \
396396 }\
397−pred(&pPredBuffer[kiStride], kiStride); \
398−ref(&pRefBuffer[kiStride], kiStride); \
397+pred(&pPredBuffer[2*kiStride], kiStride); \
398+ref(&pRefBuffer[2*kiStride], kiStride); \
399399 bool ok = true; \
400400 for (int i = 0; i < 8; i ++)\
401401 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]) {\
403403 ok = false; \
404404 break; \
405405 } \
@@ -528,15 +528,15 @@ if (ASM) { \ · 122 unmodified lines
528528 }\
529529 while(iRunTimes--) {\
530530 for (int i = 0; i < 17; i ++) {\
531− pRefBuffer[i] = pPredBuffer[i] = rand() & 255; \
532− pRefBuffer[i * kiStride - 1] = pPredBuffer[i * kiStride - 1] = rand() & 255; \
531+ pRefBuffer[kiStride + i] = pPredBuffer[kiStride + i] = rand() & 255; \
532+ pRefBuffer[(i+1) * kiStride - 1] = pPredBuffer[(i+1) * kiStride - 1] = rand() & 255; \
533533 }\
534−pred(&pPredBuffer[kiStride], kiStride); \
535−ref(&pRefBuffer[kiStride], kiStride); \
534+pred(&pPredBuffer[2*kiStride], kiStride); \
535+ref(&pRefBuffer[2*kiStride], kiStride); \
536536 bool ok = true; \
537537 for (int i = 0; i < 16; i ++)\
538538 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]) {\
540540 ok = false; \
541541 break; \
542542 } \

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