Skip to content

Commit

Permalink
Merge pull request #479 from evo-lua/fix-overflow-alert
Browse files Browse the repository at this point in the history
Fix a CodeQL warning due to potential (but virtually impossible) overflow in the RML WebGPU backend
  • Loading branch information
Duckwhale committed Feb 8, 2024
2 parents 6187557 + 0cdfccf commit 37312c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Runtime/Bindings/RmlUi_Renderer_WebGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ WGPUBuffer RenderInterface_WebGPU::CreateIndexBuffer(int* indices, int num_indic
}

WGPUTexture RenderInterface_WebGPU::CreateTexture(const uint8_t* rgbaImageBytes, const uint32_t textureWidth, const uint32_t textureHeight) {
size_t textureBufferSize = textureWidth * textureHeight * 4; // RGBA
constexpr size_t BPP = 4; // RGBA texture format is assumed
size_t textureBufferSize = static_cast<size_t>(textureWidth) * static_cast<size_t>(textureHeight) * BPP;

WGPUTextureDescriptor textureDescriptor = {
.usage = WGPUTextureUsage_CopyDst | WGPUTextureUsage_TextureBinding,
Expand Down

0 comments on commit 37312c3

Please sign in to comment.