mainBison - Support: sr #110669, error: ‘free’ of ‘yyss1’...

 
 

sr #110669: error: ‘free’ of ‘yyss1’ which points to memory not on the heap

Submitter:  None
Submitted:  Thu 02 Jun 2022 07:18:54 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  akim
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 10 Sep 2022 12:18:45 PM UTC, comment #1: 

Hi,

This is a false positive from GCC.  I can understand that GCC can be confused: indeed in some cases yyss1 points into the stack, and sometimes to the heap.  But the if above YYSTACK_FREE  is precisely there to check in which case we are.

So this is safe and works as expected.  This is a false positive.  It should be reported to GCC, since the message claims that the memory is not from the heap, which is wrong.

Cheers!

Akim Demaille <akim>
Group administrator
Thu 02 Jun 2022 07:18:54 PM UTC, original submission:  

GCC 11.2.0 -fanalyzer reports the following error in a generated parser:


error: ‘free’ of ‘yyss1’ which points to memory not on the heap [CWE-590] [-Werror=analyzer-free-of-non-heap]


referring to the following part:


#  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
      }
# endif


Since this does not seem specific to my parser, I'm posting here.

This may be a false positive from the static analyzer, though.

Anonymous

 

(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 akim (Posted a comment)
  • -email is unavailable- added by None (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
    2022-09-10 akim StatusNone Invalid
        Assigned toNone akim
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code