mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-28 14:52:24 +00:00
audio-format: Add macro checking for validity of GstAudioFormatInfo
`gst_audio_format_info_fill_silence()` not properly checking the validity of its input may lead it into an infinite loop. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2800>
This commit is contained in:
parent
7fd8e4001c
commit
3345d16aed
2 changed files with 13 additions and 1 deletions
|
@ -486,7 +486,7 @@ gst_audio_format_info_fill_silence (const GstAudioFormatInfo * info,
|
|||
{
|
||||
guint8 *dptr = dest;
|
||||
|
||||
g_return_if_fail (info != NULL);
|
||||
g_return_if_fail (GST_AUDIO_FORMAT_INFO_IS_VALID_RAW (info));
|
||||
g_return_if_fail (dest != NULL);
|
||||
|
||||
if (info->flags & GST_AUDIO_FORMAT_FLAG_FLOAT ||
|
||||
|
|
|
@ -256,6 +256,18 @@ struct _GstAudioFormatInfo {
|
|||
GST_AUDIO_API
|
||||
GType gst_audio_format_info_get_type (void);
|
||||
|
||||
/**
|
||||
* GST_AUDIO_FORMAT_INFO_IS_VALID_RAW:
|
||||
*
|
||||
* Tests that the given #GstAudioFormatInfo represents a valid un-encoded
|
||||
* format.
|
||||
*
|
||||
* Since: 1.22
|
||||
*/
|
||||
#define GST_AUDIO_FORMAT_INFO_IS_VALID_RAW(info) \
|
||||
(info != NULL && (info)->format > GST_AUDIO_FORMAT_ENCODED && \
|
||||
(info)->width > 0 && (info)->depth > 0)
|
||||
|
||||
#define GST_AUDIO_FORMAT_INFO_FORMAT(info) ((info)->format)
|
||||
#define GST_AUDIO_FORMAT_INFO_NAME(info) ((info)->name)
|
||||
#define GST_AUDIO_FORMAT_INFO_FLAGS(info) ((info)->flags)
|
||||
|
|
Loading…
Reference in a new issue