Test maximum rotation value in map loader
This commit is contained in:
parent
25c60873bc
commit
f330fffa09
1 changed files with 1 additions and 1 deletions
|
@ -117,7 +117,7 @@ std::unique_ptr<Map> Map::load(__attribute__((unused)) const std::string &name)
|
|||
unsigned rot;
|
||||
char *tile = nullptr;
|
||||
|
||||
if (std::sscanf(line.c_str(), "%c %u %ms", &c, &rot, &tile) != 3) {
|
||||
if (std::sscanf(line.c_str(), "%c %u %ms", &c, &rot, &tile) != 3 || rot >= 4) {
|
||||
std::free(tile);
|
||||
throw std::invalid_argument("invalid map file");
|
||||
}
|
||||
|
|
Reference in a new issue