From c0f5b839a0d4650b66f6842ca754114e6ff37dce Mon Sep 17 00:00:00 2001 From: cutealien Date: Fri, 13 May 2022 14:56:22 +0000 Subject: [PATCH] Avoid potential number overflows. Found by VS code analyser git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6393 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CB3DMeshWriter.cpp | 2 +- source/Irrlicht/CImage.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Irrlicht/CB3DMeshWriter.cpp b/source/Irrlicht/CB3DMeshWriter.cpp index d640e782..a7a17b59 100644 --- a/source/Irrlicht/CB3DMeshWriter.cpp +++ b/source/Irrlicht/CB3DMeshWriter.cpp @@ -98,7 +98,7 @@ bool CB3DMeshWriter::writeMesh(io::IWriteFile* file, IMesh* const mesh, s32 flag u32 numTexture = texs.size(); for (u32 i = 0; i < numTexture; i++) { - file->write(texs[i].TextureName.c_str(), texs[i].TextureName.size() + 1); + file->write(texs[i].TextureName.c_str(), (size_t)texs[i].TextureName.size() + 1); file->write(&texs[i].Flags, 7*4); } diff --git a/source/Irrlicht/CImage.cpp b/source/Irrlicht/CImage.cpp index 1f9bbb50..a076a585 100644 --- a/source/Irrlicht/CImage.cpp +++ b/source/Irrlicht/CImage.cpp @@ -194,7 +194,7 @@ void CImage::copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT fo { if (pitch==Pitch) { - memcpy(target, Data, height*pitch); + memcpy(target, Data, (size_t)height*pitch); return; } else