Skip to content

Commit

Permalink
Merge pull request #16685 from unknownbrackets/replace-crash
Browse files Browse the repository at this point in the history
Replacement: Verify out stride
  • Loading branch information
hrydgard authored Dec 31, 2022
2 parents fd5a27f + 152c82e commit 71deec1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Core/TextureReplacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/File/FileUtil.h"
#include "Common/LogReporting.h"
#include "Common/StringUtils.h"
#include "Common/Thread/ParallelLoop.h"
#include "Common/Thread/Waitable.h"
Expand Down Expand Up @@ -1278,6 +1279,10 @@ bool ReplacedTexture::Load(int level, void *out, int rowPitch) {

if (data.empty())
return false;
if (rowPitch < info.w * 4) {
ERROR_LOG_REPORT(G3D, "Replacement rowPitch=%d, but w=%d (level=%d)", rowPitch, info.w * 4, level);
return false;
}
_assert_msg_(data.size() == info.w * info.h * 4, "Data has wrong size");

if (rowPitch == info.w * 4) {
Expand Down

0 comments on commit 71deec1

Please sign in to comment.