bugpng++, a C++ wrapper for libpng - Bugs: bug #20942, No validation that a file exists...

 
 

bug #20942: No validation that a file exists in image::read()

Submitted by:  Mariano Cecowski <marjancek>
Submitted on:  Fri 31 Aug 2007 04:10:51 PM 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.

 

Fri 31 Aug 2007 07:14:19 PM UTC, comment #2:

You're right. Somehow I didn't get exceptions compiled when I tryed it. Great library! Perhaps a bit slow though.

Mariano Cecowski <marjancek>
Fri 31 Aug 2007 06:08:01 PM UTC, comment #1:

Hm... what version do you use? The following is the relevant code in the trunk:

template< class transformation >
void read(char const* filename, transformation const& transform)
{
std::ifstream stream(filename, std::ios::binary);
if (!stream.is_open())
{
throw std_error(filename);
}
stream.exceptions(std::ios::badbit);
read(stream, transform);
}

As one can see, it does throw an exception (of type png::std_error) if the file cannot be opened for some reason: file not found, permission denied, etc.

Alex

Alexander Shulgin <alexshulgin>
Project Administrator
Fri 31 Aug 2007 04:10:51 PM UTC, original submission:

Program terminates abruptly.
Perhaps setting/creating the image as a 0x0 image would do it, or at least emmiting an exception.

Mariano.

Mariano Cecowski <marjancek>

 

(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)
  • -unavailable- added by marjancek (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 31 Aug 2007 08:19:08 PM UTCalexshulginOpen/ClosedOpen=>Closed
    Fri 31 Aug 2007 06:08:01 PM UTCalexshulginStatusNone=>Works For Me

    Back to the top


    Powered by Savane 3.1-cleanup1