1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00
Commit Graph

54 Commits

Author SHA1 Message Date
millert
fb60ec6abe Update awk to the July 28, 2024 version.
* Fixed readcsvrec resize segfault when reading csv records longer than 8k.
 * Rewrite if-else chain in quoted as a switch.
2024-08-03 21:12:16 +00:00
millert
88689b4c91 Build with WARNINGS=Yes and fix resulting warnings. 2024-06-03 00:55:05 +00:00
millert
e109dc9885 Update awk to the May 4, 2024 version.
Fixes a use-after-free bug with ARGV for "delete ARGV".
2024-05-04 22:59:21 +00:00
millert
85e00e3040 Update awk to the Apr 22, 2024 version.
* fixed regex engine gototab reallocation issue that was introduced
   during the Nov 24 rewrite.

 * fixed use-after-free bug in fnematch due to adjbuf invalidating
   the pointers to buf.
2024-04-25 18:33:53 +00:00
millert
ce6cba49be Update awk to the Jan 22, 2024 version. 2024-01-25 16:40:51 +00:00
millert
c83d5272b3 Update awk to the Nov 24, 2023 version. 2023-11-25 16:31:33 +00:00
millert
6e363ec32f Update awk to the Nov 20, 2023 version.
This includes a rewrite of the fnematch() function as well as a
refactoring of the sub and gsub implementation.
2023-11-22 01:01:21 +00:00
millert
af0a16b59a fnematch: fix a bug that could result in extra chars being pushed back.
From Arnold Robbins.  https://github.com/onetrueawk/awk/pull/213
2023-11-15 18:56:53 +00:00
millert
8f894c94b7 fnematch: fix out-of-bounds access on EOF
fnematch() expects to store a NUL byte when EOF is encountered.
However, the rewrite broke this assumption because r.len from getrune()
is zero on EOF.  This results in j becoming negative on EOF, causing an
out-of-bounds access.  It is simplest to just force r.len to 1 on EOF
to copy a single NUL byte--the rune is initialized to zero even for EOF.

This also fixes the call to adjbuf().  We cannot use 'k' to determine
when we need to expand the buffer now that we are potentially reading
more than a single byte at a time.

https://github.com/onetrueawk/awk/pull/211
2023-11-15 18:48:13 +00:00
millert
2a0b182908 Minor cosmetic changes to make our awk match my github branch. 2023-10-30 17:52:54 +00:00
millert
52154eb4e7 Correctly reset the goto table for a state.
We cannot use set_gototab() to reset all the entries for a state,
it will leave existing entries as-is.  Add a new reset_gototab()
function that zeroes the table entries for the specified state.
There is no need to reset the goto table immediately after
resize_state(), it is already initialized via calloc().
Fixes https://github.com/onetrueawk/awk/issues/199
2023-10-06 22:31:21 +00:00
millert
35a004d477 Update awk to Sep 24, 2023 version.
fnematch and getrune have been overhauled to solve issues around
unicode FS and RS. also fixed gsub null match issue with unicode.
big thanks to Arnold Robbins.
2023-10-06 22:29:24 +00:00
millert
4d617ba111 Fix a potential out-of-bounds read caused by the big-endian fix.
We must store a UTF-32 empty string, not UTF-8 empty string, for
an empty CCL.  Found running the awk test suite with address sanitizer.
2023-09-21 17:19:06 +00:00
millert
c8cbb78af3 Compare int value against 0, not '\0', for consistency. 2023-09-19 01:14:05 +00:00
millert
0a9776fe9f Fix a bad cast to char * that causes incorrect results on big endian.
Now that awk stores chars as int we need to cast the Node * to int *.
2023-09-18 23:33:21 +00:00
millert
c35264f991 Disable utf-8 for non-multibyte locales, such as C or POSIX.
This makes it possible to get the old awk behavior (where chars are
bytes) by setting LC_CTYPE to C or POSIX.  OK schwarze@
2023-09-18 19:32:19 +00:00
millert
a886e62e97 Update to the One True Awk, 2nd edition (Sep 12, 2023).
This corresponds to the 2nd edition of "The AWK Programming Language"
and adds support for UTF-8 and comma-separated value inputs.
2023-09-17 14:49:44 +00:00
millert
c4bbc4f754 Avoid a potential buffer overflow in backslash escaping.
https://github.com/onetrueawk/awk/issues/121
2021-07-08 21:26:39 +00:00
millert
ff3903525f Fix size computation in replace_repeat() for special_case REPEAT_WITH_Q.
This resulted in the NUL terminator being written to the end of the
buffer which was not the same as the end of the string.  That in
turn caused garbage bytes from malloc() to be processed.  Also
change the NUL termination to be less error prone by writing the
NUL immediately after the last byte copied.  OK sthen@
2021-03-02 20:41:42 +00:00
millert
483fa115c6 Update awk to December 8, 2020 version.
Prevents strings beginning with "inf" or "nan" from being interpreted
as infinity or not-a-number respectively which still parsing "inf"
and "nan" (with or without a leading sign) correctly.
2020-12-09 20:00:11 +00:00
millert
5df2889f99 Update awk to July 30, 2020 version. 2020-07-30 17:45:44 +00:00
millert
b7fdcd16d5 Cast to uschar when storing a char in an int that will be used as an index.
Fixed as crash reported by Jan Stary when the input char has the high
bit set and FS is a regex.
2020-07-13 14:03:52 +00:00
millert
115bd590ca Update awk to June 25, 2020 version. 2020-06-26 15:57:39 +00:00
millert
fabd211e95 Update awk to Jan 31, 2020 version. 2020-06-10 21:05:02 +00:00
millert
9249712967 Update awk to Jan 5, 2020 version. 2020-06-10 21:04:40 +00:00
millert
f81b289f59 Update awk to Nov 10, 2019 version. 2020-06-10 21:03:56 +00:00
millert
d7cce23916 Update awk to Oct 24, 2019 version. 2020-06-10 21:03:36 +00:00
millert
77a7feaf48 Update awk to Oct 17, 2019 version. 2020-06-10 21:03:12 +00:00
millert
ec104564b0 Update awk to Oct 6, 2019 version. 2020-06-10 21:02:53 +00:00
millert
c0fa36112e Update awk to Sep 10, 2019 version. 2020-06-10 21:02:33 +00:00
millert
203f9af320 Update awk to Jun 17, 2019 version. 2020-06-10 21:02:19 +00:00
millert
241a7d030b Update awk to March 5, 2019 version. 2020-06-10 21:01:50 +00:00
millert
02265e669a Update awk to Jan 25, 2019 version. 2020-06-10 21:01:32 +00:00
millert
c062391adb Update awk to Aug 23, 2018 version. 2020-06-10 21:00:01 +00:00
millert
7bcc45ac75 POSIX requires that awk support \v and \a escapes. I used '\007'
for BEL since that is what lex.c uses, though we could safely use
'\a' there instead.  OK martijn@
2018-01-24 16:28:25 +00:00
deraadt
5dd7c43cc8 rename dprintf macro to DPRINTF to avoid collision with libc posix dprintf.
(amazing to me that the posix name was chosen though it specifically
collides with code Kernighan maintained since the V7).
ok millert
2017-10-09 14:51:31 +00:00
deraadt
e6a8808bf8 Use reallocarray() where suitable
ok millert doug
2014-12-19 19:28:55 +00:00
millert
000399a40c Update awk to Aug 10, 2011 version; naddy@ reports no ports problems
from the update.
2011-09-28 19:27:18 +00:00
millert
d69726353b Update awk to May 23, 2010 version. OK miod@ 2010-06-13 17:58:19 +00:00
millert
80b86fb08e Update awk to version 20071023; OK deraadt@ 2008-10-06 20:38:33 +00:00
deraadt
1ed98fdf61 use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg 2007-09-02 15:19:07 +00:00
pvalchev
412846d539 more sane calloc(3) usage; from adobriyan@gmail.com, ok millert 2006-03-19 18:17:11 +00:00
millert
23cb51ab26 Update to version 20041222; OK deraadt@ 2004-12-30 01:52:48 +00:00
millert
9a69093aa0 Update to the One True Awk version 20021213 2002-12-19 21:24:28 +00:00
millert
a27f52287e Update to latest version of the One True Awk. See the FIXES file
for details.
2001-09-08 00:12:40 +00:00
deraadt
c3e1e82e9b first pass at a -Wall cleanup 2001-07-12 05:16:53 +00:00
millert
7b11b857a5 June 6, 1999 version of the "one true awk"
Most of the changes are to avoid using a static buffer for error messages.
1999-12-08 23:09:45 +00:00
millert
271018d036 April 16, 1999 version of the "one true awk"--64-bit fixes and more. 1999-04-20 17:31:25 +00:00
millert
a4fa870006 March 5, 1999 version of the "one true awk" 1999-04-18 17:06:29 +00:00
kstailey
07edfa4a9b August 1997 version of "the one true awk" 1997-08-25 16:17:07 +00:00