1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavd/opengl_enc: check strings before parsing them.

Fix a segfault if OpenGL was not initialized before calling
write_header().
This commit is contained in:
Nicolas George 2020-02-17 12:59:27 +01:00
parent fbb36d74ac
commit 26ae9c9f8a

View File

@ -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);