bugGNU roff - Bugs: bug #63751, [tbl] reads from uninitialized...

 
 

bug #63751: [tbl] reads from uninitialized memory when reporting diagnostic

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Fri 03 Feb 2023 11:08:44 AM UTC
   
 
Category:  Preprocessor tbl Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 03 Feb 2023 09:49:57 PM UTC, comment #1: 


commit 61f2d86d93e46309f5721b3700e1b189350282dd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Fri Feb 3 05:11:46 2023 -0600

    [tbl]: Fix Savannah #63751.

    * src/preproc/tbl/main.cpp (main): Avoid reading from invalid memory
      upon failure to open an input file.

    Fixes <https://savannah.gnu.org/bugs/?63751>.


G. Branden Robinson <gbranden>
Group administrator
Fri 03 Feb 2023 11:08:44 AM UTC, original submission:  

Affects groff 1.22.4.

When attempting to open a nonexistent file after successfully opening an existing one, tbl can read from uninitialized memory.

Here is a reproducer that works on my system, but behavior seems to vary depending on details of the existing filename and maybe the current working directory.  Sticking the existent file into a subdirectory seems to be more reliable.  Odd.


$ test -f ATTIC/tableN.roff && tbl ATTIC/tableN.roff nonexistent-file >/dev/null
tbl:pH��U:11: fatal error: can't open 'nonexistent-file': No such file or directory
$ test -f existent-file.roff && tbl existent-file.roff nonexistent-file.roff >/dev/null
tbl::1: fatal error: can't open 'nonexistent-file.roff': No such file or directory
$ test -f existent-file.roff && tbl existent-file.roff nonexistent-file.roff >/dev/null
tbl:existent-file.roff:2: end of input while processing format
tbl:existent-file.roff:2: giving up on this table
tbl::3: fatal error: can't open 'nonexistent-file.roff': No such file or directory
$ test -f ATTIC/existent-file.roff && tbl ATTIC/existent-file.roff nonexistent-file.roff >/dev/null
tbl:ATTIC/existent-file.roff:2: end of input while processing format
tbl:ATTIC/existent-file.roff:2: giving up on this table
tbl:Ae�U:3: fatal error: can't open 'nonexistent-file.roff': No such file or directory


Anyway, I have a fix for this.

G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-03 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2023-02-03 gbranden Planned ReleaseNone 1.23.0

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code