swscale/utils: Add check that ensures that the hardcoded struct offsets are valid
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
c683e6aa2c
commit
c3417ed7fd
@ -429,6 +429,7 @@ typedef struct SwsContext {
|
|||||||
#define UV_OFF_BYTE "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+56"
|
#define UV_OFF_BYTE "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+56"
|
||||||
#define DITHER16 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+64"
|
#define DITHER16 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+64"
|
||||||
#define DITHER32 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+80"
|
#define DITHER32 "11*8+4*4*"AV_STRINGIFY(MAX_FILTER_SIZE)"*3+80"
|
||||||
|
#define DITHER32_INT (11*8+4*4*MAX_FILTER_SIZE*3+80) // value equal to above, used for checking that the struct hasnt been changed by mistake
|
||||||
|
|
||||||
DECLARE_ALIGNED(8, uint64_t, redDither);
|
DECLARE_ALIGNED(8, uint64_t, redDither);
|
||||||
DECLARE_ALIGNED(8, uint64_t, greenDither);
|
DECLARE_ALIGNED(8, uint64_t, greenDither);
|
||||||
|
@ -1107,6 +1107,8 @@ SwsContext *sws_alloc_context(void)
|
|||||||
{
|
{
|
||||||
SwsContext *c = av_mallocz(sizeof(SwsContext));
|
SwsContext *c = av_mallocz(sizeof(SwsContext));
|
||||||
|
|
||||||
|
av_assert0(offsetof(SwsContext, redDither) + DITHER32_INT == offsetof(SwsContext, dither32));
|
||||||
|
|
||||||
if (c) {
|
if (c) {
|
||||||
c->av_class = &sws_context_class;
|
c->av_class = &sws_context_class;
|
||||||
av_opt_set_defaults(c);
|
av_opt_set_defaults(c);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user