Commit 26ae9c9f authored by Nicolas George's avatar Nicolas George

lavd/opengl_enc: check strings before parsing them.

Fix a segfault if OpenGL was not initialized before calling
write_header().
parent fbb36d74
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment