History

tests/checkasm/checkasm.c: Assert that aligned_w/h do not overflow

Michael Niedermayer committed 1 year ago

Commit d5ad8601 parent 4aeaee11 file · +5 −2Browse files

Unified · Split

tests/checkasm/checkasm.c+5−2
@@ -58,6 +58,7 @@ · 57 unmodified lines
5858 #include <stdlib.h>
5959 #include <string.h>
6060 #include "checkasm.h"
61+#include "libavutil/avassert.h"
6162 #include "libavutil/common.h"
6263 #include "libavutil/cpu.h"
6364 #include "libavutil/intfloat.h"
@@ -1189,10 +1190,12 @@ int checkasm_check_##type(const char *file, int line, \ · 1125 unmodified lines
11891190 int align_w, int align_h, \
11901191 int padding) \
11911192 { \
1192− int aligned_w = (w + align_w - 1) & ~(align_w - 1); \
1193− int aligned_h = (h + align_h - 1) & ~(align_h - 1); \
1193+ int64_t aligned_w = (w - 1LL + align_w) & ~(align_w - 1); \
1194+ int64_t aligned_h = (h - 1LL + align_h) & ~(align_h - 1); \
11941195 int err = 0; \
11951196 int y = 0; \
1197+ av_assert0(aligned_w == (int32_t)aligned_w);\
1198+ av_assert0(aligned_h == (int32_t)aligned_h);\
11961199 stride1 /= sizeof(*buf1); \
11971200 stride2 /= sizeof(*buf2); \
11981201 for (y = 0; y < h; y++) \

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