mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
lavc/r210enc: Fix undefined behaviour encoding r10k.
Fixes the following ubsan error: libavcodec/r210enc.c:69:28: runtime error: left shift of 522 by 22 places cannot be represented in type 'int' Fixes ticket #7982.
This commit is contained in:
parent
ac457a3bc5
commit
2828f5b0d8
@ -60,9 +60,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
uint16_t *srcb = (uint16_t *)srcb_line;
|
uint16_t *srcb = (uint16_t *)srcb_line;
|
||||||
for (j = 0; j < avctx->width; j++) {
|
for (j = 0; j < avctx->width; j++) {
|
||||||
uint32_t pixel;
|
uint32_t pixel;
|
||||||
uint16_t r = *srcr++;
|
unsigned r = *srcr++;
|
||||||
uint16_t g = *srcg++;
|
unsigned g = *srcg++;
|
||||||
uint16_t b = *srcb++;
|
unsigned b = *srcb++;
|
||||||
if (avctx->codec_id == AV_CODEC_ID_R210)
|
if (avctx->codec_id == AV_CODEC_ID_R210)
|
||||||
pixel = (r << 20) | (g << 10) | b;
|
pixel = (r << 20) | (g << 10) | b;
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user