GNOME Bugzilla – Bug 796835
srtpdec: remove bogus check that accesses uninitialized memory
Last modified: 2018-11-03 14:28:11 UTC
I came across this while using valgrind to debug a unrelated problem. I'm not sure what the check was meant to do but I see no reason the check anything but the return value of gst_structure_get()
Created attachment 373092 [details] [review] srtpdec: remove bogus check that accesses uninitialized memory 'buf' is uninitialized if gst_structure_get() returns FALSE so it makes no sense to check it. If gst_structure_get() returns TRUE, then 'buf' point to a valid buffer that should be used and there is no need to check 'buf' again.
Review of attachment 373092 [details] [review]: ::: ext/srtp/gstsrtpdec.c @@ +565,3 @@ } + if (gst_structure_get (s, "srtp-key", GST_TYPE_BUFFER, &buf, NULL)) { Someone could set a NULL buffer in here, that's probably what this wanted to guard against? The better solution would be to initialize it to NULL first. Also is there the same pattern used for the SRTCP key elsewhere?
Hmm, I see. And while it makes no difference for setting 'stream->key', it would circumvent the error when a key is needed. I'll update the patch. And I've not seen that pattern elsewhere.
Created attachment 373097 [details] [review] srtpdec: remove bogus check that accesses uninitialized memory 'buf' is uninitialized if gst_structure_get() returns FALSE so it makes no sense to check it. If gst_structure_get() returns TRUE, then 'buf' point to a valid buffer that should be used and there is no need to check 'buf' again.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/754.