Re: Out of bounds read in parse.y.

2024-08-28 Thread Collin Funk
Chet Ramey writes: > Thanks. Here's the simple reproducer: > > x() > { > case y in > z) > if (! false); then > foo=bar > fi > ;; > esac > } > > > It was what I suspected. Ah, nice! Thank you for the help. Collin

Re: Out of bounds read in parse.y.

2024-08-28 Thread Chet Ramey
On 8/27/24 3:58 PM, Collin Funk wrote: I suspect there is a decrement that isn't matched by a call to set_word_top(). But a reproducer would help, otherwise we're all just guessing. Sure, the bad read was happening while reading my .profile and .bashrc file. I've narrowed it down to a bash com

Re: Out of bounds read in parse.y.

2024-08-27 Thread Collin Funk
Hi Chet, Chet Ramey writes: > Which version? This was from bash devel branch, commit hash 2e01122fe78eb5a42c9b9f3ca46b91f895959675. Built with: ./configure CFLAGS='-fsanitize=undefined' > Why? 0 is a valid index. set_word_top increments word_top before assigning > to word_lineno[word_top

Re: Out of bounds read in parse.y.

2024-08-27 Thread Chet Ramey
On 8/27/24 12:41 AM, Collin Funk wrote: Hi, When compiling with undefined behavior sanitizer and then running: Which version? $ ./bash parse.y:1000:93: runtime error: index -1 out of bounds for type 'int [257]' Please send a reproducer. The offending section of code: case_comman

Out of bounds read in parse.y.

2024-08-26 Thread Collin Funk
Hi, When compiling with undefined behavior sanitizer and then running: $ ./bash parse.y:1000:93: runtime error: index -1 out of bounds for type 'int [257]' The offending section of code: case_command: CASE WORD newline_list IN newline_list ESAC {