[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 15/25: [troff]: Fix Savannah #64301 (6/15).
From: |
G. Branden Robinson |
Subject: |
[groff] 15/25: [troff]: Fix Savannah #64301 (6/15). |
Date: |
Fri, 19 Jul 2024 15:12:43 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit cd6f015058e8bb41cbc06141acd364d6dfc5ecc7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jul 15 09:54:05 2024 -0500
[troff]: Fix Savannah #64301 (6/15).
* src/roff/troff/hvunits.h (vunits operator *): Use `ckd_mul()` instead
of primitive operation, and throw error diagnostic if arithmetic
wraps.
---
ChangeLog | 2 ++
src/roff/troff/hvunits.h | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e45d7ebe2..7078592c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,8 @@
operation, and throw error diagnostic if arithmetic wraps.
(vunits operator +): Use `ckd_add()` instead of primitive
operation, and throw error diagnostic if arithmetic wraps.
+ (vunits operator *): Use `ckd_mul()` instead of primitive
+ operation, and throw error diagnostic if arithmetic wraps.
2024-07-18 G. Branden Robinson <g.branden.robinson@gmail.com>
diff --git a/src/roff/troff/hvunits.h b/src/roff/troff/hvunits.h
index e27f78ff0..f0590fd9e 100644
--- a/src/roff/troff/hvunits.h
+++ b/src/roff/troff/hvunits.h
@@ -146,7 +146,8 @@ inline vunits operator *(const vunits & x, int n)
{
vunits r;
r = x;
- r.n *= n;
+ if (ckd_mul(&r.n, x.n, n))
+ error("integer multiplication wrapped");
return r;
}
@@ -154,7 +155,8 @@ inline vunits operator *(int n, const vunits & x)
{
vunits r;
r = x;
- r.n *= n;
+ if (ckd_mul(&r.n, n, x.n))
+ error("integer multiplication wrapped");
return r;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 15/25: [troff]: Fix Savannah #64301 (6/15).,
G. Branden Robinson <=