From c55b8c17e1d4cce1fc539f488f33d9881a525cbd Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 14 Aug 2015 00:10:46 +0200 Subject: [PATCH] Fixing #935: Secure function against random data return. --- src/SFML/Graphics/RenderTarget.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 7bb9be8d..28b35e45 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -32,9 +32,9 @@ #include #include #include +#include #include - namespace { // Convert an sf::BlendMode::Factor constant to the corresponding OpenGL constant. @@ -53,6 +53,10 @@ namespace case sf::BlendMode::DstAlpha: return GL_DST_ALPHA; case sf::BlendMode::OneMinusDstAlpha: return GL_ONE_MINUS_DST_ALPHA; } + + sf::err() << "Invalid value for sf::BlendMode::Factor! Fallback to sf::BlendMode::Zero." << std::endl; + assert(false); + return GL_ZERO; } @@ -64,6 +68,10 @@ namespace case sf::BlendMode::Add: return GLEXT_GL_FUNC_ADD; case sf::BlendMode::Subtract: return GLEXT_GL_FUNC_SUBTRACT; } + + sf::err() << "Invalid value for sf::BlendMode::Equation! Fallback to sf::BlendMode::Add." << std::endl; + assert(false); + return GLEXT_GL_FUNC_ADD; } }