aboutsummaryrefslogtreecommitdiff
path: root/bugs-fixed
diff options
context:
space:
mode:
authorCody Peter Mello <melloc@writev.io>2018-09-14 19:56:34 -0700
committerCody Peter Mello <melloc@writev.io>2018-09-14 19:56:34 -0700
commite059b3b197ce7da33b8b0b3529af65fb85b25186 (patch)
tree7ced5f2f57c2c38870d8c85e7b720f0ab71f4f17 /bugs-fixed
parent2dc7e5ff1a4feeeb549f32706cf34e17aba89192 (diff)
downloadone-true-awk-e059b3b197ce7da33b8b0b3529af65fb85b25186.tar.gz
Protect against overflowing during OFMT/CONVFMT conversions
Diffstat (limited to 'bugs-fixed')
-rw-r--r--bugs-fixed/README4
-rw-r--r--bugs-fixed/fmt-overflow.awk1
-rw-r--r--bugs-fixed/fmt-overflow.ok1
3 files changed, 6 insertions, 0 deletions
diff --git a/bugs-fixed/README b/bugs-fixed/README
index 222ef68..7c18979 100644
--- a/bugs-fixed/README
+++ b/bugs-fixed/README
@@ -23,3 +23,7 @@ and also if CONVFMT changed.
7. unary-plus: Unary plus on a string constant returned the string.
Instead, it should convert the value to numeric and give that value.
+
+X. fmt-overflow: The buffer used for OFMT/CONVFMT conversions was written
+to with sprintf(), which meant that some conversions could write past the
+end.
diff --git a/bugs-fixed/fmt-overflow.awk b/bugs-fixed/fmt-overflow.awk
new file mode 100644
index 0000000..bf5877e
--- /dev/null
+++ b/bugs-fixed/fmt-overflow.awk
@@ -0,0 +1 @@
+BEGIN { OFMT = "%.1000f"; print 1.25; }
diff --git a/bugs-fixed/fmt-overflow.ok b/bugs-fixed/fmt-overflow.ok
new file mode 100644
index 0000000..5f7449e
--- /dev/null
+++ b/bugs-fixed/fmt-overflow.ok
@@ -0,0 +1 @@
+1.2500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000