You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
CodeQL fixes, take 2 (#745)
* Protect values against integer overflow When the code multiplies integer values in an rvalue context before it's stored in a larger type, the on-the-fly math is stored as int. The value can overflow before it reaches the wider memory space. To prevent this, we explicitly cast the result of the arithmetic to the destination type. Issues flagged by GitHub CodeQL. * Apply these fixes correctly
This commit is contained in:
@@ -1537,10 +1537,9 @@ void FFmpegReader::ProcessAudioPacket(int64_t requested_frame, int64_t target_fr
|
||||
// Copy audio samples over original samples
|
||||
memcpy(audio_buf,
|
||||
audio_converted->data[0],
|
||||
static_cast<size_t>(
|
||||
audio_converted->nb_samples
|
||||
static_cast<size_t>(audio_converted->nb_samples)
|
||||
* av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)
|
||||
* info.channels)
|
||||
* info.channels
|
||||
);
|
||||
|
||||
// Deallocate resample buffer
|
||||
|
||||
Reference in New Issue
Block a user