[Scummvm-git-logs] scummvm master -> 0529d1aa21bccb189c7d84d18372eb0f3280fc94

Marisa-Chan noreply at scummvm.org
Wed Mar 11 05:51:53 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:
0529d1aa21 GAMOS: Fix possible division by zero CID 1645146


Commit: 0529d1aa21bccb189c7d84d18372eb0f3280fc94
    https://github.com/scummvm/scummvm/commit/0529d1aa21bccb189c7d84d18372eb0f3280fc94
Author: Marisa-Chan (thunder_8888 at mail.ru)
Date: 2026-03-11T12:51:44+07:00

Commit Message:
GAMOS: Fix possible division by zero CID 1645146

Changed paths:
    engines/gamos/vm.cpp


diff --git a/engines/gamos/vm.cpp b/engines/gamos/vm.cpp
index c915c49720c..1c85428afac 100644
--- a/engines/gamos/vm.cpp
+++ b/engines/gamos/vm.cpp
@@ -361,8 +361,12 @@ uint32 VM::Context::execute(uint32 scriptAddress, byte *storage) {
 
 		case OP_DIV:
 			ECX = EAX;
-            EAX.setVal( (int32)EDX.getVal() / (int32)ECX.getVal() );
-            EDX.setVal( (int32)EDX.getVal() % (int32)ECX.getVal() );
+			if (ECX.getVal() != 0) {
+				EAX.setVal( (int32)EDX.getVal() / (int32)ECX.getVal() );
+				EDX.setVal( (int32)EDX.getVal() % (int32)ECX.getVal() );
+			} else {
+				warning("Division by 0 at %x", ESI);
+			}
 			break;
 
 		case OP_MOV_EAX_BPTR_EDI:




More information about the Scummvm-git-logs mailing list