less SEGV with multiple non-existent files

Bug #320217 reported by Andrew Pollock
4
Affects Status Importance Assigned to Milestone
less (Debian)
Fix Released
Unknown
Nominated for Lenny by Andrew Pollock
less (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: less

If less encounters two nonexistant files then an existing file it will segfault.

To reproduce, run this command line then press :n a few times:
F="/tmp/a1 /tmp/a2 /tmp/a3"; touch /tmp/a4; touch $F; ( sleep 0.5; rm $F ) & LD_PRELOAD=/lib/libSegFault.so less $F /tmp/a4

Note also, just before it crashes (between the final colon and n presses) it says:
@J º : No such file or directory (press RETURN)

Backtrace (anchored at 00400000):
#0 0x000000000040b675 in ?? ()
#1 0x00000000004098a1 in edit_ifile ()
#2 0x0000000000409a3a in edit_istep ()
#3 0x000000000040764f in ?? ()
#4 0x00000000004021e6 in ?? ()
#5 0x00007ffd718de1c4 in __libc_start_main () from /lib/libc.so.6
#6 0x0000000000401c39 in ?? ()
#7 0x00007fff7a0787f8 in ?? ()
#8 0x0000000000000000 in ?? ()

Frame 1 looks like this:
edit_ifile(ifile)
...
               if (alt_filename != NULL)
               {
                       close_altfile(alt_filename, filename, alt_pipe); // <====
                       free(alt_filename);
               }
               del_ifile(ifile);
               free(qopen_filename);

Revision history for this message
Mark Painter (mpainter) wrote :

Note that this is when the files exist at less invocation but have been deleted before viewing, and does not reproduce simply by giving less file names that do not exist.

Changed in less:
status: Unknown → New
shankao (shankao)
Changed in less:
status: New → Confirmed
Changed in less (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.