[FFmpeg-cvslog] lavd/opengl_enc: check strings before parsing them.
Nicolas George
git at videolan.org
Thu Feb 20 15:38:49 EET 2020
ffmpeg | branch: master | Nicolas George <george at nsup.org> | Mon Feb 17 12:59:27 2020 +0100| [26ae9c9f8aebbf4b925649f971f90c0dee047aa9] | committer: Nicolas George
lavd/opengl_enc: check strings before parsing them.
Fix a segfault if OpenGL was not initialized before calling
write_header().
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=26ae9c9f8aebbf4b925649f971f90c0dee047aa9
---
libavdevice/opengl_enc.c | 4 ++++
1 file changed, 4 insertions(+)
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);
More information about the ffmpeg-cvslog
mailing list