mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
Use g_memdup2() where available and add fallback for older GLib versions
- x264 encoder bitrate profile manager: alloc size is based on existing allocation - asfdemux: change length var to 64-bit and check for G_MAXUINT - realmedia: opaque_data_len is read from 32 bits and then only subtracted upon. g_memdup() is deprecated since GLib 2.68 and we want to avoid deprecation warnings with recent versions of GLib. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/merge_requests/83>
This commit is contained in:
parent
caae1a632a
commit
cc1a7e2c4d
4 changed files with 17 additions and 7 deletions
|
@ -18,6 +18,9 @@
|
|||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstencoderbitrateprofilemanager.h"
|
||||
|
||||
|
@ -95,7 +98,7 @@ gst_encoder_bitrate_profile_manager_add_profile (GstEncoderBitrateProfileManager
|
|||
* self, const gchar * profile_name,
|
||||
const GstEncoderBitrateTargetForPixelsMap * map)
|
||||
{
|
||||
gint n_vals;
|
||||
guint n_vals;
|
||||
GstEncoderBitrateProfile *profile;
|
||||
|
||||
for (n_vals = 0;
|
||||
|
@ -107,7 +110,7 @@ gst_encoder_bitrate_profile_manager_add_profile (GstEncoderBitrateProfileManager
|
|||
profile->name = g_strdup (profile_name);
|
||||
profile->n_vals = n_vals;
|
||||
profile->map
|
||||
= g_memdup (map, sizeof (GstEncoderBitrateTargetForPixelsMap) * n_vals);
|
||||
= g_memdup2 (map, sizeof (GstEncoderBitrateTargetForPixelsMap) * n_vals);
|
||||
self->profiles = g_list_prepend (self->profiles, profile);
|
||||
}
|
||||
|
||||
|
|
|
@ -2458,15 +2458,18 @@ gst_asf_demux_get_buffer (GstBuffer ** p_buf, guint num_bytes_to_read,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_asf_demux_get_bytes (guint8 ** p_buf, guint num_bytes_to_read,
|
||||
gst_asf_demux_get_bytes (guint8 ** p_buf, guint64 num_bytes_to_read,
|
||||
guint8 ** p_data, guint64 * p_size)
|
||||
{
|
||||
*p_buf = NULL;
|
||||
|
||||
if (num_bytes_to_read >= G_MAXUINT)
|
||||
return FALSE;
|
||||
|
||||
if (*p_size < num_bytes_to_read)
|
||||
return FALSE;
|
||||
|
||||
*p_buf = g_memdup (*p_data, num_bytes_to_read);
|
||||
*p_buf = g_memdup2 (*p_data, num_bytes_to_read);
|
||||
*p_data += num_bytes_to_read;
|
||||
*p_size -= num_bytes_to_read;
|
||||
return TRUE;
|
||||
|
|
|
@ -436,7 +436,7 @@ rtsp_ext_real_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
|||
if (strncmp (opaque_data, "MLTI", 4)) {
|
||||
GST_DEBUG_OBJECT (ctx, "no MLTI found, appending all");
|
||||
stream->type_specific_data_len = opaque_data_len;
|
||||
stream->type_specific_data = g_memdup (opaque_data, opaque_data_len);
|
||||
stream->type_specific_data = g_memdup2 (opaque_data, opaque_data_len);
|
||||
goto no_type_specific;
|
||||
}
|
||||
opaque_data += 4;
|
||||
|
@ -530,7 +530,7 @@ rtsp_ext_real_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
|||
goto strange_opaque_data;
|
||||
}
|
||||
stream->type_specific_data =
|
||||
g_memdup (opaque_data, stream->type_specific_data_len);
|
||||
g_memdup2 (opaque_data, stream->type_specific_data_len);
|
||||
|
||||
no_type_specific:
|
||||
size =
|
||||
|
|
|
@ -18,7 +18,7 @@ gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90
|
|||
|
||||
have_cxx = add_languages('cpp', native: false, required: false)
|
||||
|
||||
glib_req = '>= 2.44.0'
|
||||
glib_req = '>= 2.56.0'
|
||||
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
|
||||
|
||||
api_version = '1.0'
|
||||
|
@ -168,6 +168,10 @@ endif
|
|||
|
||||
gmodule_dep = dependency('gmodule-2.0', fallback : ['glib', 'libgmodule_dep'])
|
||||
|
||||
if gmodule_dep.version().version_compare('< 2.67.4')
|
||||
cdata.set('g_memdup2(ptr,sz)', '(G_LIKELY(((guint64)(sz)) < G_MAXUINT)) ? g_memdup(ptr,sz) : (g_abort(),NULL)')
|
||||
endif
|
||||
|
||||
ugly_args = ['-DHAVE_CONFIG_H']
|
||||
configinc = include_directories('.')
|
||||
libsinc = include_directories('gst-libs')
|
||||
|
|
Loading…
Reference in a new issue