[Scummvm-git-logs] scummvm master -> ecd12fb2ff0434da5eb22ff3a0fafb93e20fdb93
whoozle
noreply at scummvm.org
Tue Mar 10 22:34:31 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
ecd12fb2ff VIDEO: 4XM: fix ubsan warnings
Commit: ecd12fb2ff0434da5eb22ff3a0fafb93e20fdb93
https://github.com/scummvm/scummvm/commit/ecd12fb2ff0434da5eb22ff3a0fafb93e20fdb93
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-03-10T22:33:04Z
Commit Message:
VIDEO: 4XM: fix ubsan warnings
Changed paths:
video/4xm_decoder.cpp
video/4xm_utils.h
diff --git a/video/4xm_decoder.cpp b/video/4xm_decoder.cpp
index 98c9a85221c..5c3cc2d0695 100644
--- a/video/4xm_decoder.cpp
+++ b/video/4xm_decoder.cpp
@@ -348,18 +348,16 @@ void mcdc(uint16_t *dst, const uint16_t *src, int log2w,
int h = 1 << log2h;
if (Scale) {
for (int i = 0; i < h; ++i) {
- auto *dst32 = reinterpret_cast<uint32_t *>(dst);
- auto *src32 = reinterpret_cast<const uint32_t *>(src);
switch (log2w) {
case 3:
- dst32[2] = src32[2] + dc;
- dst32[3] = src32[3] + dc;
+ WRITE_UINT32(dst + 4, READ_UINT32(src + 4) + dc);
+ WRITE_UINT32(dst + 6, READ_UINT32(src + 6) + dc);
// fall through
case 2:
- dst32[1] = src32[1] + dc;
+ WRITE_UINT32(dst + 2, READ_UINT32(src + 2) + dc);
// fall through
case 1:
- dst32[0] = src32[0] + dc;
+ WRITE_UINT32(dst, READ_UINT32(src) + dc);
break;
case 0:
*dst = *src + dc;
@@ -369,17 +367,16 @@ void mcdc(uint16_t *dst, const uint16_t *src, int log2w,
}
} else {
for (int i = 0; i < h; ++i) {
- auto *dst32 = reinterpret_cast<uint32_t *>(dst);
switch (log2w) {
case 3:
- dst32[2] = dc;
- dst32[3] = dc;
+ WRITE_UINT32(dst + 4, dc);
+ WRITE_UINT32(dst + 6, dc);
// fall through
case 2:
- dst32[1] = dc;
+ WRITE_UINT32(dst + 2, dc);
// fall through
case 1:
- dst32[0] = dc;
+ WRITE_UINT32(dst, dc);
break;
case 0:
*dst = dc;
diff --git a/video/4xm_utils.h b/video/4xm_utils.h
index 5c6e459fe52..bd051e26460 100644
--- a/video/4xm_utils.h
+++ b/video/4xm_utils.h
@@ -54,6 +54,8 @@ HuffmanType loadStatistics(const byte *&huff, uint &offset) {
void idct(int16_t block[64], int shift = 6);
inline int readInt(int value, unsigned n) {
+ if (n == 0)
+ return 0;
if ((value & (1 << (n - 1))) == 0)
value += 1 - (1 << n);
return value;
More information about the Scummvm-git-logs
mailing list