Skip to content

Commit

Permalink
Add color mode check when loading MAT file format
Browse files Browse the repository at this point in the history
  • Loading branch information
smlu committed May 19, 2019
1 parent 7ac8317 commit 87deb1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libim/content/asset/material/impl/serialization/mat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ Material& Material::deserialize(const InputStream& istream)
throw StreamError("MAT file record count <= 0");
}

if(header.colorInfo.colorMode < ColorMode::RGB ||
header.colorInfo.colorMode > ColorMode::RGBA) {
throw StreamError("Invalid color mode");
}

if(header.colorInfo.bpp % 8 != 0) {
throw StreamError("BPP % 8 != 0");
}
Expand Down

0 comments on commit 87deb1f

Please sign in to comment.