fzwoch / obs-vaapi

OBS Studio VAAPI support via GStreamer
GNU General Public License v2.0
118 stars 3 forks source link

Getting a segfault form libpci #21

Closed jnettlet closed 9 months ago

jnettlet commented 9 months ago

I believe you sscanf matching implementation in get_device_name and populate_devices is slightly incorrect. Your format specifier matches everything up to the - character which leaves the separator as part of the domain integer. If the domain is zero this is most likely irrelevant since -0 should be overlooked. However for my configuration this was making the domain -4 which is obviously invalid. Instead I have changed the code as following to get things up and working.

@@ -649,7 +649,7 @@ static void populate_devices(obs_property_t *prop)
                char device[1024] = {};
                int domain, bus, dev, fun;

-               sscanf(list[i]->d_name, "%*[^-]%x:%x:%x.%x%*s", &domain, &bus,
+               sscanf(list[i]->d_name, "%*[^-]-%x:%x:%x.%x%*s", &domain, &bus,
                       &dev, &fun);
fzwoch commented 9 months ago

Nice catch, thanks!

jnettlet commented 9 months ago

No problem. Thanks for the excellent plugin. Thanks for integrating the fix so quickly. I was actually planning on sending a pull request later.

Just one correct the function populate_devices() also needs this same fix.

Thanks, Jon


From: Florian Zwoch @.> Sent: Monday, November 13, 2023 3:25 PM To: fzwoch/obs-vaapi @.> Cc: Jon Nettleton @.>; Author @.> Subject: Re: [fzwoch/obs-vaapi] Getting a segfault form libpci (Issue #21)

Nice catch, thanks!

— Reply to this email directly, view it on GitHubhttps://github.com/fzwoch/obs-vaapi/issues/21#issuecomment-1808263580, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AINUS3EHKE6PE7X4WBFXOBTYEIUWLAVCNFSM6AAAAAA7IRSMC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBYGI3DGNJYGA. You are receiving this because you authored the thread.Message ID: @.***>

fzwoch commented 9 months ago

Ugh, didn't realize I had it twice because of the legacy encoders. Fixed!