bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Franklin, Jason
Subject: [bug] Segmentation fault in the "fc" builtin (additional change)
Date: Tue, 5 May 2020 09:56:15 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

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 in reverse.

However, histbeg and histend are swapped after histend is checked in the
original patch.  So, I have attached an updated patch that avoids the
following additional segfault:

  $ bash --norc
  $ fc -0 100
  Segmentation fault (core dumped)

This patch works by moving the reversal of histbeg and histend to before
when histend is checked.  This handles the other case when a segfault
could occur (where histbeg is real_last).

Thanks again for reviewing!

-- 
Jason Franklin

Attachment: fc_fix_updated.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]