FLTK logo

[fltk/fltk] Fix BMP loading bug; fix problem accepting invalid image (#228)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] Fix BMP loading bug; fix problem accepting invalid image (#228) Kevin Routley May 03, 2021  
 

This is a two part fix.

Part 1: If given a text file which has the first two characters as "BM", Fl_BMP_Image will attempt to load that file as a valid bitmap file. Depending on what is in the text file, Fl_BMP_Image will crash in various ways.

The fix is to verify the existence of some required attributes of a valid Bitmap header and set the file's fail() state.

Part 2: Having fixed the above bug, I then discovered that Fl_Shared_Image did not check the fail() state, and proceeded to act as if the invalid Fl_BMP_Image was in fact valid.

The fix here is to check the fail() state: in a failure situation, delete the invalid object, and continue iterating through the image handlers.


You can view, comment on, or merge this pull request online at:

  https://github.com/fltk/fltk/pull/228

Commit Summary

  • Fix BMP loading bug; fix problem accepting invalid image

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.