mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
drivers/video: Fix multiplication overflow
Add cast to uint32_t type to avoid multiplication overflow.
This commit is contained in:
committed by
Petro Karashchenko
parent
c0ea6c5b49
commit
1212d3b7d8
@@ -626,11 +626,13 @@ static void get_clipped_format(uint8_t nr_fmt,
|
|||||||
&fmt[VIDEO_FMT_SUB],
|
&fmt[VIDEO_FMT_SUB],
|
||||||
sizeof(video_format_t));
|
sizeof(video_format_t));
|
||||||
|
|
||||||
c_fmt[VIDEO_FMT_SUB].width *= clip->width;
|
c_fmt[VIDEO_FMT_SUB].width
|
||||||
c_fmt[VIDEO_FMT_SUB].width /= fmt[VIDEO_FMT_MAIN].width;
|
= (uint32_t)c_fmt[VIDEO_FMT_SUB].width
|
||||||
|
* clip->width / fmt[VIDEO_FMT_MAIN].width;
|
||||||
|
|
||||||
c_fmt[VIDEO_FMT_SUB].height *= clip->height;
|
c_fmt[VIDEO_FMT_SUB].height
|
||||||
c_fmt[VIDEO_FMT_SUB].height /= fmt[VIDEO_FMT_MAIN].height;
|
= (uint32_t)c_fmt[VIDEO_FMT_SUB].height
|
||||||
|
* clip->height / fmt[VIDEO_FMT_MAIN].height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user