summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2020-02-17 12:59:27 +0100
committerNicolas George <george@nsup.org>2020-02-20 14:37:11 +0100
commit26ae9c9f8aebbf4b925649f971f90c0dee047aa9 (patch)
treedb52318cf76df8b6a340107cfc429159540dcec4 /libavdevice
parentfbb36d74ac6c491cdde552863981a593059e94b7 (diff)
downloadffmpeg-26ae9c9f8aebbf4b925649f971f90c0dee047aa9.tar.gz
lavd/opengl_enc: check strings before parsing them.
Fix a segfault if OpenGL was not initialized before calling write_header().
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/opengl_enc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index fa94345a7c..b07f9c2e43 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -588,6 +588,10 @@ static av_cold int opengl_read_limits(AVFormatContext *h)
version = glGetString(GL_VERSION);
extensions = glGetString(GL_EXTENSIONS);
+ if (!version || !extensions) {
+ av_log(h, AV_LOG_ERROR, "No OpenGL context initialized for the current thread\n");
+ return AVERROR(ENOSYS);
+ }
av_log(h, AV_LOG_DEBUG, "OpenGL version: %s\n", version);
sscanf(version, "%d.%d", &major, &minor);