mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
rmdemux: Check for integer overflows when calculating the size of SIPR audio buffers
Fixes ZDI-CAN-21443 Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2782 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5072>
This commit is contained in:
parent
763d2bb43c
commit
b268b27cd8
1 changed files with 7 additions and 1 deletions
|
@ -2144,6 +2144,7 @@ gst_rmdemux_descramble_sipr_audio (GstRMDemux * rmdemux,
|
|||
GstMapInfo outmap;
|
||||
guint packet_size = stream->packet_size;
|
||||
guint height = stream->subpackets->len;
|
||||
guint size;
|
||||
guint p;
|
||||
|
||||
g_assert (stream->height == height);
|
||||
|
@ -2151,7 +2152,12 @@ gst_rmdemux_descramble_sipr_audio (GstRMDemux * rmdemux,
|
|||
GST_LOG_OBJECT (rmdemux, "packet_size = %u, leaf_size = %u, height= %u",
|
||||
packet_size, stream->leaf_size, height);
|
||||
|
||||
outbuf = gst_buffer_new_and_alloc (height * packet_size);
|
||||
if (!g_uint_checked_mul (&size, height, packet_size)) {
|
||||
GST_ERROR_OBJECT (rmdemux, "overflowing SIPR audio packet size");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
outbuf = gst_buffer_new_and_alloc (size);
|
||||
gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE);
|
||||
|
||||
for (p = 0; p < height; ++p) {
|
||||
|
|
Loading…
Reference in a new issue