bugpng++, a C++ wrapper for libpng - Bugs: bug #38234, img::write_stream crashes when...

 
 

bug #38234: img::write_stream crashes when called with a reference to an output stream.

Submitted by:  None
Submitted on:  Sat 02 Feb 2013 11:01:50 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Works For Me
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sat 02 Feb 2013 01:56:21 PM UTC, comment #3:

No problem. And I need to make a new release I guess...

Alexander Shulgin <alexshulgin>
Project Administrator
Sat 02 Feb 2013 11:36:25 AM UTC, comment #2:

Actually now that I try, no, I (stupidly) assumed it would, since the template version of write_stream was unchanged on the trunk - the difference being that the other write_stream was completely removed, not renamed.

I'm actually bit dumbfounded on what quirk of compilation breaks it on the older version then, but seems to be fine now that it's not overloaded.

Sorry for bothering with an already fixed issue.

Anonymous
Sat 02 Feb 2013 11:08:48 AM UTC, comment #1:

Hello,

Does this problem still exist in trunk: http://svn.sv.nongnu.org/svn/pngpp/trunk/ ?

--
Alex

Alexander Shulgin <alexshulgin>
Project Administrator
Sat 02 Feb 2013 11:01:50 AM UTC, original submission:

On the latest release version (0.2.5) calling myFunc() on:

void writePNG(ostream& os) {
image< rgba_pixel > img(256, 256);
img.write_stream(os);
}

void myFunc() {
ofstream ofs("image.png", std::ios::binary);
writePNG(os);
ofs.close();
}

Will cause crash since there are two methods named img::write_stream in image.hpp, with the other one taking the parameter as template argument.

The template version seems to be implictly preferred in the above case, causing a crash since it treats the input value as a type of ostream&&

Renaming the non-template version of img::write_stream to img::write and calling that solves the problem. Assumably it should be named as img::write, since there exist img::read for streams already?

Anonymous

 

(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 alexshulgin (Posted a comment)
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 02 Feb 2013 01:56:21 PM UTCalexshulginOpen/ClosedOpen=>Closed
      StatusNeed Info=>Works For Me
    Sat 02 Feb 2013 11:08:48 AM UTCalexshulginStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1