File
video/out/hwdec/hwdec_cuda_gl.c:87
Description
Extra cuCtxPopCurrent causing CUDA context stack underflow. cuda_ext_gl_init pops the CUDA context in its error path, but the caller (mapper_init in hwdec_cuda.c) already manages the context push/pop:
In hwdec_cuda_gl.c:87 (error path of cuda_ext_gl_init):
error:
CHECK_CU(cu->cuCtxPopCurrent(&dummy)); // pop #1
return false;
In hwdec_cuda.c:191,201 (caller):
CHECK_CU(cu->cuCtxPushCurrent(p->display_ctx)); // push
for (...) {
if (!p_owner->ext_init(...)) // calls cuda_ext_gl_init
goto error;
}
error:
CHECK_CU(cu->cuCtxPopCurrent(&dummy)); // pop #2 - double pop!
Why It's a Bug
The caller pushes the context once and expects exactly one pop. The callee (cuda_ext_gl_init) pops it on error, and the caller also pops it, causing a CUDA context stack underflow. This can corrupt CUDA driver state and crash subsequent CUDA operations.
Suggested Fix
Remove the cuCtxPopCurrent from cuda_ext_gl_init's error path (line 87). The caller handles the context management.
Severity
Major
File
video/out/hwdec/hwdec_cuda_gl.c:87
Description
Extra
cuCtxPopCurrentcausing CUDA context stack underflow.cuda_ext_gl_initpops the CUDA context in its error path, but the caller (mapper_initin hwdec_cuda.c) already manages the context push/pop:In
hwdec_cuda_gl.c:87(error path ofcuda_ext_gl_init):In
hwdec_cuda.c:191,201(caller):Why It's a Bug
The caller pushes the context once and expects exactly one pop. The callee (
cuda_ext_gl_init) pops it on error, and the caller also pops it, causing a CUDA context stack underflow. This can corrupt CUDA driver state and crash subsequent CUDA operations.Suggested Fix
Remove the
cuCtxPopCurrentfromcuda_ext_gl_init's error path (line 87). The caller handles the context management.Severity
Major