mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 14:11:15 +00:00
h264bitwriter: Add check for data size to avoid overflow
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7547>
This commit is contained in:
parent
b427f33818
commit
2652467d7c
1 changed files with 2 additions and 1 deletions
|
@ -1571,6 +1571,7 @@ gst_h264_bit_writer_convert_to_nal (guint nal_prefix_size, gboolean packetized,
|
||||||
GST_H264_BIT_WRITER_ERROR);
|
GST_H264_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (raw_data != NULL, GST_H264_BIT_WRITER_ERROR);
|
g_return_val_if_fail (raw_data != NULL, GST_H264_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (raw_size > 0, GST_H264_BIT_WRITER_ERROR);
|
g_return_val_if_fail (raw_size > 0, GST_H264_BIT_WRITER_ERROR);
|
||||||
|
g_return_val_if_fail (raw_size / 8 <= G_MAXUINT, GST_H264_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (nal_data != NULL, GST_H264_BIT_WRITER_ERROR);
|
g_return_val_if_fail (nal_data != NULL, GST_H264_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (nal_size != NULL, GST_H264_BIT_WRITER_ERROR);
|
g_return_val_if_fail (nal_size != NULL, GST_H264_BIT_WRITER_ERROR);
|
||||||
g_return_val_if_fail (*nal_size > 0, GST_H264_BIT_WRITER_ERROR);
|
g_return_val_if_fail (*nal_size > 0, GST_H264_BIT_WRITER_ERROR);
|
||||||
|
@ -1598,7 +1599,7 @@ gst_h264_bit_writer_convert_to_nal (guint nal_prefix_size, gboolean packetized,
|
||||||
|
|
||||||
nal_writer_init (&nw, nal_prefix_size, packetized);
|
nal_writer_init (&nw, nal_prefix_size, packetized);
|
||||||
|
|
||||||
if (!nal_writer_put_bytes (&nw, raw_data, raw_size / 8))
|
if (!nal_writer_put_bytes (&nw, raw_data, (guint) (raw_size / 8)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (raw_size % 8) {
|
if (raw_size % 8) {
|
||||||
|
|
Loading…
Reference in a new issue