bugGNU roff - Bugs: bug #55693, Possible bug in file...

 
 

bug #55693: Possible bug in file src/devices/grohtml/post-html.cpp line 1751

Submitter:  Petru-Florin Mihancea <petrum2>
Submitted:  Mon 11 Feb 2019 12:57:30 PM UTC
   
 
Category:  Driver grohtml Severity:  3 - Normal
Item Group:  Build/Installation Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 22 Jan 2022 06:41:04 AM UTC, comment #3: 

Placing in "Build/Installation" item group as that's the closest relation we have to anything static analysis-related.

I rule out "Lint" because it's no mere matter of code style, and "Warning/Suspicious behavior" because that relates to diagnostic messages that are (or should be) emitting by groff components at run time.

This is a matter of code semantics (undefined behavior).

Let's hope we don't need a dedicated item group for these!

G. Branden Robinson <gbranden>
Group administrator
Tue 25 May 2021 02:28:41 AM UTC, comment #2: 

Hi Petru,

Thanks again for the report.  This issue is now fixed in Git.

Unfortunately, I hosed the bug number in the commit message, but I will correct it in the ChangeLog in commit that is forthcoming soon.


commit 7dcb6263dcb3edcf373fff0a6e1f62242d18950e
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun May 23 13:01:52 2021 +1000

    [grohtml]: Avoid deallocation of static strings.

    * src/devices/grohtml/post-html.cpp (assert_state::add): Avoid potential
      deallocation of statically-allocated strings.  Use strsave() to
      duplicate them so that they can be safely handed to a_delete().  Also
      update diagnostic message to report name of complaining program
      (continuing the long process of fixing Savannah #52463).

    Fixes <https://savannah.gnu.org/bugs/index.php?60656>.  Thanks to
    Petru-Florin Mihancea for the report.

    Also wrap source lines at 72 columns.


G. Branden Robinson <gbranden>
Group administrator
Sun 23 May 2021 03:04:43 AM UTC, comment #1: 

Let me offer my belated thanks for this report.

Working on this.

The solution would appear to be to copy the static literals with strsave() so that they can be safely (and unconditionally) deallocated with a_delete() later.

These are groff-specific idioms and functions.

G. Branden Robinson <gbranden>
Group administrator
Mon 11 Feb 2019 12:57:30 PM UTC, original submission:  

While experimenting with a novel static analysis technique in CodeSonar, we noticed the following potential problem at the next location:

FilePath: src/devices/grohtml/post-html.cpp
Function: assert_state::add
Line number: 1751

At that line, the f pointer is deallocated. However, f may point to the "stdin" literal assigned to it in line 1740 resulting in the deallocation of a non-heap pointer.

Thanks,
Petru-Florin Mihancea

Petru-Florin Mihancea <petrum2>

 

(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 (Posted a comment)
  • -email is unavailable- added by petrum2 (Submitted the item)
  • -email is unavailable- added by petrum2
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-01-22 gbranden Item GroupNone Build/Installation
    2021-05-25 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2021-05-23 gbranden StatusNone In Progress
        Assigned toNone gbranden
    2019-02-11 petrum2 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code