⬢ DragonFlyBSD Kernel Audit
DF-2241 / fix.diff
← back to finding ↓ download raw
--- a/sys/ddb/db_expr.c
+++ b/sys/ddb/db_expr.c
@@ -144,7 +144,10 @@
 	    if (t == tSTAR)
 		lhs *= rhs;
 	    else {
-		if (rhs == 0) {
+		if (rhs == 0 ||
+		    (rhs == -1 &&
+		     lhs == (db_expr_t)0x8000000000000000UL)) {
+		    /* LONG_MIN / -1 overflows and raises #DE on x86 */
 		    db_error("Divide by 0\n");
 		    /*NOTREACHED*/
 		}