Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16282

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

From "Franklin, Jason" <jason.franklin@quoininc.com>
Newsgroups gnu.bash.bug
Subject [bug] Segmentation fault in the "fc" builtin (additional change)
Date 2020-05-05 09:56 -0400
Organization Quoin, Inc.
Message-ID <mailman.2132.1588686988.3066.bug-bash@gnu.org> (permalink)
References <99e4723e-c675-aa45-3d50-4a2313a5d36d@quoininc.com>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

[bug] Segmentation fault in the "fc" builtin (additional change) "Franklin, Jason" <jason.franklin@quoininc.com> - 2020-05-05 09:56 -0400

csiph-web