FS#56175 - [libvdpau] Fails to interop with DRI_PRIME due undeclared secure_getenv assuming int
Attached to Project:
Arch Linux
Opened by Cody Schafer (cody) - Tuesday, 31 October 2017, 02:24 GMT
Last edited by Jan de Groot (JGC) - Saturday, 11 November 2017, 22:51 GMT
Opened by Cody Schafer (cody) - Tuesday, 31 October 2017, 02:24 GMT
Last edited by Jan de Groot (JGC) - Saturday, 11 November 2017, 22:51 GMT
|
Details
Description:
libvdpau uses `secure_getenv()` to retrieve the value of the "DRI_PRIME" environment variable. `secure_getenv()` requires that `_GNU_SOURCE` be defined for it to be avaliable. In libvdpau-1.1.1, `_GNU_SOURCE` is not defined, so the definition is not avaliable. As a result, the return value of `secure_getenv()` is assumed to be `int`, which on 64-bit platforms causes the pointer value to be truncated/sign extended, resulting in a segfault. Gdb session with buggy libvdpau-1.1.1: (gdb) p prime $1 = 0xffffffffffffee8b <error: Cannot access memory at address 0xffffffffffffee8b> (gdb) call ((char*(*)(char*))secure_getenv)("DRI_PRIME") $2 = 0x7fffffffee8b "1" (gdb) call secure_getenv("DRI_PRIME") $3 = -4469 Additional info: * Upstream commit 1cda354bdfd0c9ca107293b84b52f4464fdbedcc fixes this bug. https://cgit.freedesktop.org/vdpau/libvdpau/commit/?id=1cda354bdfd0c9ca107293b84b52f4464fdbedcc Steps to reproduce: - Install `vdpauinfo` (or anything that uses libvdpau). - Run `DRI_PRIME=1 vdpauinfo` - Observe segfault - Apply patch, try again, observe successful output (or at least no segfault). I've attached both the patch for libvdpau itself, and a patch to the libvdpau pkgbuild as I retrieved it today. |
This task depends upon