aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-02-28Fix hwasan global overflow. (#76)android-mainline-11.0.0_r44android-mainline-11.0.0_r43android-mainline-11.0.0_r42android-mainline-11.0.0_r41android-mainline-11.0.0_r40android-mainline-11.0.0_r39android-mainline-11.0.0_r38android-mainline-11.0.0_r37android-mainline-11.0.0_r36android-mainline-11.0.0_r35android-mainline-11.0.0_r34android-mainline-11.0.0_r32android-mainline-11.0.0_r31android-mainline-11.0.0_r30android-mainline-11.0.0_r28android-mainline-11.0.0_r27android-mainline-11.0.0_r26android-mainline-11.0.0_r25android-mainline-11.0.0_r24android-mainline-11.0.0_r23android-mainline-11.0.0_r22android-mainline-11.0.0_r21android-mainline-11.0.0_r20android-mainline-11.0.0_r18android-mainline-11.0.0_r17android-mainline-11.0.0_r16android-mainline-11.0.0_r15android-mainline-11.0.0_r14android-mainline-11.0.0_r13android-mainline-11.0.0_r12android11-mainline-tethering-releaseandroid11-mainline-permission-releaseandroid11-mainline-os-statsd-releaseandroid11-mainline-networkstack-releaseandroid11-mainline-media-swcodec-releaseandroid11-mainline-media-releaseandroid11-mainline-extservices-releaseandroid11-mainline-documentsui-releaseandroid11-mainline-conscrypt-releaseandroid11-mainline-cellbroadcast-releaseandroid11-mainline-captiveportallogin-releaseandroid11-devenh-google
* Fix hwasan global overflow. Crash found with https://source.android.com/devices/tech/debug/hwasan but also detectable by regular ASan. Here's an ASan crash: ==215690==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55d90f8da140 at pc 0x55d90f8b7503 bp 0x7ffd3dae6100 sp 0x7ffd3dae60f8 READ of size 4 at 0x55d90f8da140 thread T0 #0 0x55d90f8b7502 in word /tmp/awk/lex.c:496 #1 0x55d90f8b939f in yylex /tmp/awk/lex.c:191 #2 0x55d90f894ab9 in yyparse /tmp/awk/awkgram.tab.c:2366 #3 0x55d90f89edc2 in main /tmp/awk/main.c:216 #4 0x7ff263a78bba in __libc_start_main ../csu/libc-start.c:308 #5 0x55d90f8945a9 in _start (/tmp/awk/a.out+0x115a9) 0x55d90f8da141 is located 0 bytes to the right of global variable 'infunc' defined in 'awkgram.y:35:6' (0x55d90f8da140) of size 1 SUMMARY: AddressSanitizer: global-buffer-overflow /tmp/awk/lex.c:496 in word Shadow bytes around the buggy address: 0x0abba1f133d0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 0x0abba1f133e0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 0x0abba1f133f0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 0x0abba1f13400: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00 0x0abba1f13410: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 =>0x0abba1f13420: 04 f9 f9 f9 f9 f9 f9 f9[01]f9 f9 f9 f9 f9 f9 f9 0x0abba1f13430: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0abba1f13440: 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 0x0abba1f13450: f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 0x0abba1f13460: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 0x0abba1f13470: f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 And here's the stack trace from hwasan: Stack Trace: RELADDR FUNCTION FILE:LINE 00000000000168d4 word external/one-true-awk/lex.c:496:18 000000000002d1ec yyparse y.tab.c:2460:16 000000000001c82c main external/one-true-awk/main.c:179:2 00000000000b41a0 __libc_init bionic/libc/bionic/libc_init_dynamic.cpp:151:8 As it says, we're doing a 4-byte read from a 1-byte global. `infunc` is declared as an int but defined as a bool. Signed-off-by: Evgenii Stepanov <eugenis@google.com> * Add ASan cflags to makefile. They're not used by default, but this way they're easily to hand next time they're wanted. Bug: http://b/150168534 Test: treehugger (cherry picked from commit 7b245a02668dcb9f9677b36f5745cfd07cc216bd) Change-Id: I1302532f27970b3e73df6536238c2777798bd102
2020-02-10Upgrade one-true-awk to e9c99065fd31253a4db4a6bce673decd143f7a3e am: ↵Automerger Merge Worker
69b38a7b2d am: b449b2550c am: a8dca89194 Change-Id: I03638f7dfb56f76f3ff8ddd3e614deed18cd7daf
2020-02-10Upgrade one-true-awk to e9c99065fd31253a4db4a6bce673decd143f7a3e am: ↵Automerger Merge Worker
69b38a7b2d am: b449b2550c Change-Id: I8a9bb47900a36c47d9347beb0613b822632dfd9b
2020-02-10Upgrade one-true-awk to e9c99065fd31253a4db4a6bce673decd143f7a3e am: 69b38a7b2dAutomerger Merge Worker
Change-Id: Ibbe36fd1dd5cb5cd3f4a1d890794788a00ac7975
2020-02-10Upgrade one-true-awk to e9c99065fd31253a4db4a6bce673decd143f7a3eHaibo Huang
Test: None Change-Id: I1deb6d8c9e61f129ee3cfe324eea796a5dc7b0c8
2020-02-07Update README.md PR instructions.Arnold D. Robbins
2020-02-06Restore zoulas fixes, stage 3.Arnold D. Robbins
2020-02-06Restore zoulas fixes, stages 2.Arnold D. Robbins
2020-02-06Restore zoulas fixes, step 1.Arnold D. Robbins
2020-02-06Revert zoulas changes until we can keep tests passing.Arnold D. Robbins
2020-02-06Update version and FIXES.Arnold D. Robbins
2020-02-06Fix closeall for portability.Arnold D. Robbins
2020-02-06misc fixes (#69)zoulasc
* Add a test for german case folding. * Add a function to copy a string with a string with a larger allocation (to be used by the case folding routines) * Add printf attributes to the printf-like functions and fix one format warning * Cleanup the tempfree macro * make more functions static * rename fp to frp (FRame Pointer) to avoid shadowing with fp (File Pointer). * add more const * fix indent in UPLUS case * add locale-aware case folding * make nfiles size_t * fix bugs in file closing: - compare fclose to EOF and pclose to -1 - use nfiles instead of FOPEN_MAX in closeall - don't close files we did not open (0,1,2) fpurge/fflush instead * - use NUL instead of 0 for char comparisons - add ISWS() macro - use continue; instead of ; * Check for existance of the german locale before using it. * Add missing parentheses, thanks Arnold.
2020-01-31Get tests working again.Arnold D. Robbins
2020-01-31Fix a{0}, update tests.Arnold D. Robbins
2020-01-31Merge branch 'fix-int-expr-zero'Arnold D. Robbins
2020-01-31Use MB_LEN_MAX instead of MB_CUR_MAX to avoid VLA (#70)Michael Forney
MB_CUR_MAX is the maximum number of bytes in a multibyte character for the current locale, and might not be a constant expression. MB_LEN_MAX is the maximum number of bytes in a multibyte character for any locale, and always expands to a constant-expression.
2020-01-24Fix for a{0} bug.Arnold D. Robbins
2020-01-24Update version info.Arnold D. Robbins
2020-01-24Small fixes (#68)zoulasc
* sprinkle const, static * account for lineno in unput * Add an EMPTY string that is used when a non-const empty string is needed. * make inputFS static and dynamically allocated * Simplify and in the process avoid -Wwritable-strings * make fs const to avoid -Wwritable-strings
2020-01-22Set the close-on-exec flag for file and pipe redirections.Arnold D. Robbins
2020-01-19Fix Issue 60; sub/gsub follow POSIX if POSIXLY_CORRECT in the environment.Arnold D. Robbins
2020-01-17Add TODO file.Arnold D. Robbins
2020-01-17Update date in version.Arnold D. Robbins
2020-01-17Make I/O errors fatal instead of mere warnings (#63)Martijn Dekker
An input/output error indicates a fatal condition, even if it occurs when closing a file. Awk should not return success on I/O error, but treat I/O errors as it already treats write errors. Test case: $ (trap '' PIPE; awk 'BEGIN { print "hi"; }'; echo "E $?" >&2) | : awk: i/o error occurred while closing /dev/stdout source line number 1 E 2 The test case pipes a line into a dummy command that reads no input, with SIGPIPE ignored so we rely on awk's own I/O checking. No write error is detected, because the pipe is buffered; the broken pipe is only detected as an I/O error on closing stdout. Before this commit, "E 0" was printed (indicating status 0/success) because an I/O error merely produced a warning. A shell script was unable to detect the I/O error using the exit status.
2020-01-10rename T.concat to T.csconcat to avoid case-insensitive conflict (#64)Martijn Dekker
On case-insensitive file systems (i.e.: macOS), T.concat and t.concat are the same file, so these conflicted. This commit renames T.concat to avoid the conflict.
2020-01-09Upgrade one-true-awk to 944989bf683d30f306d8f29a3eb8c68c7c603fb4 am: ↵Automerger Merge Worker
2b2ca9f3fb am: 78cb1093df am: 7be0794073 Change-Id: I31b2a71bd29660973c47448599812f37d575c9a6
2020-01-09Upgrade one-true-awk to 944989bf683d30f306d8f29a3eb8c68c7c603fb4 am: ↵Automerger Merge Worker
2b2ca9f3fb am: 78cb1093df Change-Id: If30c3fa0bd004ab6a0f68d84de9e30b63edde767
2020-01-09Upgrade one-true-awk to 944989bf683d30f306d8f29a3eb8c68c7c603fb4Haibo Huang
am: 2b2ca9f3fb Change-Id: I26ec1b0ffe5f7d2f805cf7c4ce5c719dcfe11d12
2020-01-08Upgrade one-true-awk to 944989bf683d30f306d8f29a3eb8c68c7c603fb4android-r-preview-1Haibo Huang
Test: None Change-Id: Ic0ebc6c68e9b4244deff227c75065fd1a029430f
2020-01-06Minor fixes.Arnold D. Robbins
2020-01-05Fix merging of concatenated string constants.Arnold D. Robbins
2020-01-01Correct text in README.md.Arnold D. Robbins
2020-01-01Small formatting cleanups in b.c.Arnold D. Robbins
2020-01-01Cleanups from valgrind.Arnold D. Robbins
2019-12-27Bug fix in interval expressions.Arnold D. Robbins
2019-12-11More edits in README.md.Arnold D. Robbins
2019-12-11Add last updated date to README.md.Arnold D. Robbins
2019-12-11Move README to README.md.Arnold D. Robbins
2019-12-11Small edits, update version and FIXES.Arnold D. Robbins
2019-12-11Fix printf format conversions. (#59)zoulasc
Further simplify printf % parsing by eating the length specifiers during the copy phase, and substitute 'j' when finalizing the format. Add some more tests for this.
2019-12-10Upgrade one-true-awk to af86dacfad85857b2ea9fa95150ddd8c671695ed am: ↵Automerger Merge Worker
094c2ecf3b am: a625fe19ee am: cffae5c3d8 Change-Id: Ifc0a70da8f2766ee2b3628f1a9080232ee95d821
2019-12-10Upgrade one-true-awk to af86dacfad85857b2ea9fa95150ddd8c671695ed am: ↵Automerger Merge Worker
094c2ecf3b am: a625fe19ee Change-Id: Iba74cf32ae69382e5acd33559258546cda3d2beb
2019-12-10Upgrade one-true-awk to af86dacfad85857b2ea9fa95150ddd8c671695edHaibo Huang
am: 094c2ecf3b Change-Id: I61e6a0cc3d8dddf138a59a40cc8e26df42ed73be
2019-12-09Upgrade one-true-awk to af86dacfad85857b2ea9fa95150ddd8c671695edHaibo Huang
Test: None Change-Id: Ia8f758e4a120ced4a161428b99144cf02041eac4
2019-12-09Fix memory corruption manifested on 32 bit binaries (#58)zoulasc
* Don't update gototab entries for HAT (corrupts memory)
2019-12-08Update version and FIXES.Arnold D. Robbins
2019-12-08Fix printf formats for integers (#57)zoulasc
* More cleanups: - sprinkle const - add a macro (setptr) that cheats const to temporarily NUL terminate strings remove casts from allocations - use strdup instead of strlen+strcpy - use x = malloc(sizeof(*x)) instead of x = malloc(sizeof(type of *x))) - add -Wcast-qual (and casts through unitptr_t in the two macros we cheat (xfree, setptr)). * More cleanups: - add const - use bounded sscanf - use snprintf instead of sprintf * More cleanup: - use snprintf/strlcat instead of sprintf/strcat - use %j instead of %l since we are casting to intmax_t/uintmax_t * Merge the 3 copies of the code that evaluated array strings with separators and convert them to keep track of lengths and use memcpy instead of strcat. * Fix formats for 32 bit machines broken by previous commit. We use intmax_t to provide maximum range for both 32 and 64 bit machines.
2019-11-12Upgrade one-true-awk to 108224b4845d7ac622cdc3dcbe47b463e4253a4b. am: ↵Elliott Hughes
d804c3da82 am: ea265ccd63 am: 8a8e20ab0f Change-Id: Ifa792795a88d8e1a1c78c8122185f7d1d99c083f
2019-11-12Upgrade one-true-awk to 108224b4845d7ac622cdc3dcbe47b463e4253a4b. am: d804c3da82Elliott Hughes
am: ea265ccd63 Change-Id: Ic2113bf73a86e7fff4f15d8c90c22c4ae7af604a