[bug] Segmentation fault in the "fc" builtin

2020-05-05 Thread Franklin, Jason
Greetings: Yesterday, I encountered a segmentation fault when using the "fc" builtin command. I cloned the Bash source code from GNU Savannah, and I verified that the bug is still present in the latest commits to the master and devel branches (the work below applies to "devel"). To reproduce...

[bug] Segmentation fault in the "fc" builtin (additional change)

2020-05-05 Thread Franklin, Jason
Greetings: After sending the original email concerning this issue, I delved into the code again for one last review. I discovered that, even after the original fix a segmentation fault is still possible, because histbeg could be higher than histend! The idea from "fc" would be to print the list

Re: [bug] Segmentation fault in the "fc" builtin

2020-05-05 Thread Chet Ramey
On 5/5/20 9:21 AM, Franklin, Jason wrote: > Greetings: > > Yesterday, I encountered a segmentation fault when using the "fc" > builtin command. I cloned the Bash source code from GNU Savannah, and I > verified that the bug is still present in the latest commits to the > master and devel branches

Re: [bug] Segmentation fault in the "fc" builtin

2020-05-05 Thread Franklin, Jason
On 5/5/20 11:41 AM, Chet Ramey wrote: > Thanks for the report and your careful analysis. > >> >> Allow me to explain the reasoning behind the patch... >> >> From the CHANGES file, we see this note concerning the "fc" builtin: >> >> b. The fc builtin now interprets -0 as the current command line

Re: [bug] Segmentation fault in the "fc" builtin

2020-05-05 Thread Chet Ramey
On 5/5/20 12:16 PM, Franklin, Jason wrote: > Agreed. This is an undocumented feature, which is why Brandon and I had > a bit of trouble figuring out what "should" happen. :/ > >> I'm leaning towards making 0 and -0 out-of-range errors for the non-listing >> case. This is what other shells do (th