bugText Extractor TXR - Bugs: bug #28033, swprintf function does not behave...

 
 

bug #28033: swprintf function does not behave like snprintf, leading to crash.

Submitted by:  Kaz Kylheku <kkylheku>
Submitted on:  Mon 16 Nov 2009 09:05:31 PM UTC  
 
Category: NoneSeverity: 5 - Blocker
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Kaz Kylheku <kkylheku>
Originator Name: Open/Closed: Closed
Component Version: 021Operating System: None
Fixed Release: 022Planned Release: 022
Architecture: AllABI: All

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 17 Nov 2009 08:19:14 PM UTC, comment #1:

This is now fixed. Txr's streams no longer support a printf-like interface.

The sprintf is used for some conversions (with ample buffer space provided), and there is still that hack in dump_vars which uses swprintf.

Other than that, the only code that now uses printf is some debugging code generated by lex, which is not enabled, because it's wrapped in #ifdef YYDEBUG.

Kaz Kylheku <kkylheku>
Project AdministratorIn charge of this item.
Mon 16 Nov 2009 09:05:31 PM UTC, original submission:

Txr originally used snprintf in the implementation of formatted printing to streams. This function, if the buffer is too small, returns the number of characters that would have been written into a sufficiently large buffer. The program can then use this number to allocate a buffer and run the formatted print again.

Unfortunately, the ISO C people decided to invent a different return value convention for the wide-character version of snprintf! This function returns the useless value -1 if the buffer is insufficiently large.

This gaping inconsistency breaks txr. When a string stream is used in the generation of an exception, an assertion goes off in the formatted print, which also wants to raise an exception, leading to a runaway recursion.

Kaz Kylheku <kkylheku>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kkylheku (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 17 Nov 2009 08:19:14 PM UTCkkylhekuStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
      Fixed ReleaseNone=>022
      Planned ReleaseNone=>022

    Back to the top


    Powered by Savane 3.1-cleanup1