[FFmpeg-devel] [PATCH 2/5] avcodec/dstdec: Check for overflow in build_filter()
Rémi Denis-Courmont
remi at remlab.net
Sun Sep 11 10:51:15 EEST 2022
Hi,
Down-casting to a signed type (here, int16_t) is implementation-defined. And while normal compilers do the expected thing, with modulo-2^n complement, sanitizers tend to dislike it.
AFAIK, the clean solution is via an union whence you assign the uint16_t member, and then read the int16_t member. Fortunately, GCC and LLVM are able to optimise that construct back to a single sign-extension.
Br,
More information about the ffmpeg-devel
mailing list