-
Notifications
You must be signed in to change notification settings - Fork 0
Sync upstream GStreamer into ignis-main #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ignis-main
Are you sure you want to change the base?
Changes from all commits
9d0bac6
488fe60
3a79e74
6441dce
bd5a93e
c4bb776
0fba45d
e637707
3aea9d7
8b0cef1
0fcf108
bb8af1f
0b284a9
8c6d4df
eec42c2
0eafdff
6272cd8
06a2861
fa26e36
64d9d1a
49b1f6f
b32d2d5
9950541
51b8a3b
f1a482f
fa8f2e7
8b83631
db4d6c1
01f263b
ee3af4d
fddfed9
2411e7b
c829d30
e214ff8
1fb00eb
be5c96e
badd956
dfad70b
6c79ed0
642fa31
cae6e21
4ec54b4
00578d6
7058301
659e6ba
d97d3c3
82ce42a
11110fe
32effb4
967cd8c
cc48c6d
70a113d
97a3f3f
f276bb4
5cb4247
3719ee1
c5053e8
d8b2228
9d8a5df
e0676de
185aaae
4a837cd
00b9d8d
153e388
c339de4
47e8e07
e7a9bf2
3004208
7748ef2
fdadda6
0a20bc6
9a34ada
33dc864
2ffa726
73b6b28
8ccaa8b
128b89d
e7fbb43
653d4c1
9f87a0f
644b5dc
89ca0a2
143cb59
f795e3a
84223cb
9e31c61
e7a56fc
1b6b177
d05b76b
e1869dd
6dab206
9eec2d8
c88b3fd
6399068
d41d199
9c768e4
4ac78e6
c713c48
ed7baf9
c8e4752
0882ebf
3be0fb5
9cb37ee
4df3c4e
4c35363
4cc1b3e
3c390f1
72ffee0
b088e02
1c94997
8e6cd6f
168082d
ca8b458
f5bcbfb
4b74682
f0e2e76
ccce6d5
09e9376
80c38d8
f3213d6
3c39ca9
719fefe
26bb3f0
9e36587
90e74ea
8ae4dd8
32f067a
2f157d5
f4c415f
7055a3b
bfaa6f6
165ff26
2404b3d
3806cad
300e780
067c3c9
2a8e25b
1e292c4
461a24a
9ffe7dd
a5a188d
49b1cf5
5bd7078
da2728f
2b878cc
f69b720
ef46043
f1f3a25
5523536
dd2b47c
93fa4cd
abd0d9d
3aaa02c
bc471af
726fa5d
cf4f7cb
178ae5a
342055d
544fd78
5a7bf7f
042d386
dd4b11b
15185ff
df04669
8d11a2a
d267103
945e139
85cdda9
340428b
010db8a
90334d7
900df44
a3b3b85
0947ea6
4bf9e3a
5f80c62
26b3b64
8004d60
12bb99f
e20f209
9b7c21c
4d87673
7b05d4c
7f69f70
c2e9cf2
932e41f
be81caf
f47963a
f628faa
ceb503e
8ec9836
f9914f2
8e9eab8
1fb0526
5ab4f7c
d64676e
b3ccf2e
c767052
123034e
16bdbd5
ebcdef2
0758f84
cbab56c
4fecfe9
3bb557f
4525172
feeddc2
d276ea6
c82daea
a31e39c
f3c9a1f
f6a5f61
b2d20c0
612e710
b9bbed6
216d548
c3635eb
ece6d9e
cd6ba24
9e6dfc5
8f85c5d
a37638f
649bfda
59cb5dc
1949e75
5835751
3787b97
016409a
12a536e
22a8dbd
353a7c9
3481980
5a1471c
bc453dc
bbb433e
a131589
97c1e0c
d4ad7a5
c453fc4
17ad744
4b08826
d77569e
db802b4
ae148b9
f48e989
2373d5b
66dbb36
3d74b04
bd23f98
36c4354
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| /* | ||
| * Copyright 2026 Google Inc. | ||
| * author: Arthur SC Chan <arthur.chan@adalogics.com> | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* Audio converter/resampler/quantize fuzzing target | ||
| * | ||
| * Exercises: | ||
| * gst-libs/gst/audio/audio-converter.c | ||
| * gst-libs/gst/audio/audio-resampler.c | ||
| * gst-libs/gst/audio/audio-quantize.c | ||
| */ | ||
|
|
||
| #ifdef HAVE_CONFIG_H | ||
| #include "config.h" | ||
| #endif | ||
|
|
||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <glib.h> | ||
| #include <gst/gst.h> | ||
| #include <gst/audio/audio.h> | ||
|
|
||
| #define HEADER_SIZE 8 | ||
| #define MAX_FRAMES 4096 | ||
| #define MAX_RESAMPLE_BYTES (16 * 1024 * 1024) | ||
|
|
||
| /* All formats exercised by the converter path */ | ||
| static const GstAudioFormat all_formats[] = { | ||
| GST_AUDIO_FORMAT_S8, GST_AUDIO_FORMAT_U8, | ||
| GST_AUDIO_FORMAT_S16LE, GST_AUDIO_FORMAT_U16LE, | ||
| GST_AUDIO_FORMAT_S24LE, GST_AUDIO_FORMAT_S32LE, | ||
| GST_AUDIO_FORMAT_U32LE, GST_AUDIO_FORMAT_F32LE, | ||
| GST_AUDIO_FORMAT_F64LE, | ||
| }; | ||
|
|
||
| #define N_ALL_FORMATS G_N_ELEMENTS(all_formats) | ||
|
|
||
| /* Resampler only accepts these four formats */ | ||
| static const GstAudioFormat resamp_formats[] = { | ||
| GST_AUDIO_FORMAT_S16, GST_AUDIO_FORMAT_S32, | ||
| GST_AUDIO_FORMAT_F32, GST_AUDIO_FORMAT_F64, | ||
| }; | ||
|
|
||
| #define N_RESAMP_FORMATS G_N_ELEMENTS(resamp_formats) | ||
|
|
||
| static const gint rates[] = { | ||
| 100, 997, 7919, | ||
| 8000, 11025, 16000, 22050, | ||
| 32000, 44100, 48000, 96000, | ||
| 8009, 22051, 44101 | ||
| }; | ||
|
|
||
| #define N_RATES G_N_ELEMENTS(rates) | ||
|
|
||
| /* Channel counts the audio converter's mix matrix supports out of the box. */ | ||
| static const gint mixable_channels[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | ||
|
|
||
| #define N_MIXABLE_CHANNELS G_N_ELEMENTS(mixable_channels) | ||
|
|
||
| static void | ||
| custom_logger (const gchar * log_domain, | ||
| GLogLevelFlags log_level, const gchar * message, gpointer unused_data) | ||
| { | ||
| if (log_level & G_LOG_LEVEL_CRITICAL) { | ||
| g_printerr ("CRITICAL ERROR : %s\n", message); | ||
| abort (); | ||
| } else if (log_level & G_LOG_LEVEL_WARNING) { | ||
| g_printerr ("WARNING : %s\n", message); | ||
| } | ||
| } | ||
|
|
||
| int | ||
| LLVMFuzzerTestOneInput (const guint8 * data, size_t size) | ||
| { | ||
| static gboolean initialized = FALSE; | ||
|
|
||
| if (!initialized) { | ||
| g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL); | ||
| g_log_set_default_handler (custom_logger, NULL); | ||
| gst_init (NULL, NULL); | ||
| initialized = TRUE; | ||
| } | ||
|
|
||
| if (size < HEADER_SIZE) | ||
| return 0; | ||
|
|
||
| GstAudioFormat in_fmt = all_formats[data[0] % N_ALL_FORMATS]; | ||
| GstAudioFormat out_fmt = all_formats[data[1] % N_ALL_FORMATS]; | ||
|
|
||
| /* Picked from the supported mix-matrix set so the converter actually runs. */ | ||
| gint in_ch = mixable_channels[data[2] % N_MIXABLE_CHANNELS]; | ||
| gint in_rate = rates[data[3] % N_RATES]; | ||
| gint out_rate = rates[data[4] % N_RATES]; | ||
| GstAudioResamplerMethod rm = (GstAudioResamplerMethod) ((data[5] >> 4) % 5); | ||
| GstAudioFormat resamp_fmt = resamp_formats[data[5] % N_RESAMP_FORMATS]; | ||
| GstAudioDitherMethod dither = (GstAudioDitherMethod) ((data[6] >> 4) % 4); | ||
| GstAudioNoiseShapingMethod ns = | ||
| (GstAudioNoiseShapingMethod) ((data[6] & 0x0f) % 5); | ||
| guint quantizer = (guint) data[6] + 1; | ||
|
|
||
| const guint8 *audio_data = data + HEADER_SIZE; | ||
| gsize audio_size = size - HEADER_SIZE; | ||
|
|
||
| /* audio converter */ | ||
| { | ||
| gint out_ch = mixable_channels[data[7] % N_MIXABLE_CHANNELS]; | ||
| GstAudioInfo in_info, out_info; | ||
| GstAudioConverter *conv; | ||
|
|
||
| gst_audio_info_set_format (&in_info, in_fmt, in_rate, in_ch, NULL); | ||
| gst_audio_info_set_format (&out_info, out_fmt, out_rate, out_ch, NULL); | ||
| conv = gst_audio_converter_new (0, &in_info, &out_info, NULL); | ||
| if (conv) { | ||
| if (audio_size > 0) { | ||
| gpointer out = NULL; | ||
| gsize out_size = 0; | ||
| gst_audio_converter_convert (conv, 0, (gpointer) audio_data, | ||
| audio_size, &out, &out_size); | ||
| g_free (out); | ||
| } | ||
| gst_audio_converter_free (conv); | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Converter fuzzer can exhaust memoryMedium Severity The audio converter path calls Reviewed by Cursor Bugbot for commit 36c4354. Configure here. |
||
|
|
||
| /* audio resampler */ | ||
| { | ||
| GstAudioResampler *resampler; | ||
|
|
||
| resampler = gst_audio_resampler_new (rm, 0, resamp_fmt, in_ch, | ||
| in_rate, out_rate, NULL); | ||
| if (resampler) { | ||
| const GstAudioFormatInfo *finfo = gst_audio_format_get_info (resamp_fmt); | ||
| gsize frame_size = (finfo->width / 8) * in_ch; | ||
| if (frame_size > 0 && audio_size >= frame_size) { | ||
| gsize in_frames = MIN (audio_size / frame_size, MAX_FRAMES); | ||
| gsize out_frames = | ||
| gst_audio_resampler_get_out_frames (resampler, in_frames); | ||
| if (out_frames > 0) { | ||
| gsize out_buf_size = out_frames * (finfo->width / 8) * in_ch; | ||
| /* Cap allocation to keep the fuzzer alive on extreme rate ratios. */ | ||
| if (out_buf_size > 0 && out_buf_size <= MAX_RESAMPLE_BYTES) { | ||
| gpointer out_buf = g_malloc0 (out_buf_size); | ||
| gpointer in_ptrs[1] = { (gpointer) audio_data }; | ||
| gpointer out_ptrs[1] = { out_buf }; | ||
| gst_audio_resampler_resample (resampler, in_ptrs, in_frames, | ||
| out_ptrs, out_frames); | ||
| g_free (out_buf); | ||
| } | ||
| } | ||
| } | ||
| gst_audio_resampler_free (resampler); | ||
| } | ||
| } | ||
|
|
||
| /* audio quantize */ | ||
| { | ||
| GstAudioQuantize *quant = gst_audio_quantize_new (dither, ns, 0, | ||
| GST_AUDIO_FORMAT_S32, 1, quantizer); | ||
| if (quant) { | ||
| const gsize frame_size = sizeof (gint32); | ||
| if (audio_size >= frame_size) { | ||
| guint frames = (guint) MIN (audio_size / frame_size, MAX_FRAMES); | ||
| gpointer out_buf = g_malloc0 (frames * frame_size); | ||
| gpointer in_ptrs[1] = { (gpointer) audio_data }; | ||
| gpointer out_ptrs[1] = { out_buf }; | ||
| gst_audio_quantize_samples (quant, in_ptrs, out_ptrs, frames); | ||
| g_free (out_buf); | ||
| } | ||
| gst_audio_quantize_free (quant); | ||
| } | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cerbero security skip rule order
Medium Severity
The new
gstreamer-securitywhen: neverrule oncerbero triggersits after- if: '$MESON_COMMIT'. GitLab applies the first matching rule, so a non-emptyMESON_COMMITstill starts Cerbero ongstreamer-security, unlike Windows/macOS jobs that check the project name first.Reviewed by Cursor Bugbot for commit a53b91e. Configure here.