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
58#include <stdlib.h>58#include <stdlib.h>
59#include <string.h>59#include <string.h>
60#include "checkasm.h"60#include "checkasm.h"
61#include "libavutil/avassert.h"
61#include "libavutil/common.h"62#include "libavutil/common.h"
62#include "libavutil/cpu.h"63#include "libavutil/cpu.h"
63#include "libavutil/intfloat.h"64#include "libavutil/intfloat.h"
@@ -1189,10 +1190,12 @@ int checkasm_check_##type(const char *file, int line, \ · 1125 unmodified lines
1189 int align_w, int align_h, \1190 int align_w, int align_h, \
1190 int padding) \1191 int padding) \
1191{ \1192{ \
1192 int aligned_w = (w + align_w - 1) & ~(align_w - 1); \1193 int64_t aligned_w = (w - 1LL + align_w) & ~(align_w - 1); \
1193 int aligned_h = (h + align_h - 1) & ~(align_h - 1); \1194 int64_t aligned_h = (h - 1LL + align_h) & ~(align_h - 1); \
1194 int err = 0; \1195 int err = 0; \
1195 int y = 0; \1196 int y = 0; \
1197 av_assert0(aligned_w == (int32_t)aligned_w);\
1198 av_assert0(aligned_h == (int32_t)aligned_h);\
1196 stride1 /= sizeof(*buf1); \1199 stride1 /= sizeof(*buf1); \
1197 stride2 /= sizeof(*buf2); \1200 stride2 /= sizeof(*buf2); \
1198 for (y = 0; y < h; y++) \1201 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