Tcl Source Code

Artifact [fd94f42ceb]
Login

Artifact fd94f42cebf6eae943fbfad3a23dd77605efe873381a494e90f23bf6b2125732:

Attachment "cb90038a63.diff" to ticket [cb90038a63] added by chrstphrchvz 2022-02-17 15:26:10. (unpublished)
diff --git generic/tclExecute.c generic/tclExecute.c
index 97ac1f0b..b96eab4e 100644
--- generic/tclExecute.c
+++ generic/tclExecute.c
@@ -6286,7 +6286,8 @@ TEBCresume(
 			    (lResult * l2 != l1)) {
 			lResult -= 1;
 		    }
-		    lResult = l1 - l2*lResult;
+		    lResult = (long)((unsigned long)l1 -
+			    (unsigned long)l2*(unsigned long)lResult);
 		    goto longResultOfArithmetic;
 		}
 		break;
@@ -8544,7 +8545,8 @@ ExecuteExtendedBinaryMathOp(
 			&& (wQuotient * w2 != w1)) {
 		    wQuotient -= (Tcl_WideInt) 1;
 		}
-		wRemainder = w1 - w2*wQuotient;
+		wRemainder = (Tcl_WideInt)((Tcl_WideUInt)w1 -
+			(Tcl_WideUInt)w2*(Tcl_WideUInt)wQuotient);
 		WIDE_RESULT(wRemainder);
 	    }