Skip to content

Commit

Permalink
Fixing SFML#935: Secure function against random data return.
Browse files Browse the repository at this point in the history
  • Loading branch information
susnux authored and eXpl0it3r committed Aug 24, 2015
1 parent 506ec95 commit 0f1dc5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/SFML/Graphics/RenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/GLCheck.hpp>
#include <SFML/System/Err.hpp>
#include <cassert>
#include <iostream>


namespace
{
// Convert an sf::BlendMode::Factor constant to the corresponding OpenGL constant.
Expand All @@ -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;
}


Expand All @@ -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;
}
}

Expand Down

0 comments on commit 0f1dc5a

Please sign in to comment.