<div dir="ltr"><div>Hey,</div><div>I think I messed up with the commit history in this patch, do you want me to rebase the commit in v1 and v2 together and send a new patch ?</div><div><br></div><div>Regards,</div><div><i><b>Vedant Paranjape</b></i><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 2, 2021 at 12:54 AM Vedant Paranjape <<a href="mailto:vedantparanjape160201@gmail.com">vedantparanjape160201@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Error checking the output from generateConfiguration() was missing in<br>
the code. Only assert was added as a guard which checked if the size of<br>
generated camera config was equal to size of roles passed to it.<br>
<br>
If the roles argument has a invalid member, it will return a nullptr and then<br>
trying to access a member on a nullptr for size comparison will result in a<br>
segmentation fault. So, if the function returns a nullptr, it will simply put<br>
a error on GstBus and gracefully exit.<br>
<br>
Signed-off-by: Vedant Paranjape <<a href="mailto:vedantparanjape160201@gmail.com" target="_blank">vedantparanjape160201@gmail.com</a>><br>
---<br>
src/gstreamer/gstlibcamerasrc.cpp | 4 ++--<br>
1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp<br>
index 8b6057df..910c0f83 100644<br>
--- a/src/gstreamer/gstlibcamerasrc.cpp<br>
+++ b/src/gstreamer/gstlibcamerasrc.cpp<br>
@@ -375,9 +375,9 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,<br>
<br>
/* Generate the stream configurations, there should be one per pad. */<br>
state->config_ = state->cam_->generateConfiguration(roles);<br>
- if (state->config_ == nullptr) {<br>
+ if (state->config_ == nullptr && state->config_->size() == state->srcpads_.size()) {<br>
GST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,<br>
- ("Failed to generate camera configuration from roles"),<br>
+ ("Failed to generate camera configuration from"),<br>
("Camera::generateConfiguration() returned nullptr"));<br>
gst_task_stop(task);<br>
return;<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>