Memory safety fixes

This commit is contained in:
Henrik Rydgård
2025-05-22 01:01:40 +02:00
parent d782382f28
commit 6bf8d7d1db
3 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -319,7 +319,7 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
VR_SetConfig(VR_CONFIG_CANVAS_6DOF, g_Config.bEnable6DoF);
//inform engine about the status
TouchInput touch;
TouchInput touch{};
touch.id = mouseController;
touch.x = x * dp_xscale;
touch.y = (height - y - 1) * dp_yscale;
+1 -1
View File
@@ -530,7 +530,7 @@ bool NPDRMDemoBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
if (table_[block].size < blockSize_) {
int lzsize = lzrc_decompress(blockBuf_, 0x00100000, readBuf, table_[block].size);
if(lzsize!=blockSize_){
if(lzsize != blockSize_){
ERROR_LOG(Log::Loader, "LZRC decompress error! lzsize=%d\n", lzsize);
NotifyReadError();
return false;
+6 -3
View File
@@ -215,14 +215,17 @@ int lzrc_decompress(void *out, int out_len, void *in, int in_len)
if(rc.lc&0x80){
/* plain text */
memcpy(rc.output, rc.input+5, rc.code);
return rc.code;
int copySize = rc.code;
if (copySize > out_len) {
copySize = out_len;
}
memcpy(rc.output, rc.input+5, copySize);
return copySize;
}
rc_state = 0;
last_byte = 0;
while (1) {
round += 1;
match_step = 0;