Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Crash when loading some jpeg files
Crash when loading some jpeg files [message #59508] Tue, 10 January 2023 09:52 Go to next message
pvictor is currently offline  pvictor
Messages: 67
Registered: December 2015
Member
Hi,

While working with thousands of jpeg files, I've found a few, which cause app crash.
One of them is attached.

Here's a simple testcase:
Test.upp:
description "Test\377";

uses
	Core,
	plugin/jpg;

file
	Test.cpp;

mainconfig
	"" = "";

Test.cpp:
#include <Core/Core.h>
#include <Draw/Draw.h>

using namespace Upp;

CONSOLE_APP_MAIN {
	String im = LoadFile("/tmp/test.jpg");
	Image img = StreamRaster::LoadStringAny(im);	// Segmentation fault (core dumped)
	Cout() << "OK\n";
}

TheIDE: 16666
OS: Ubuntu 20.04

Best regards,
Victor
  • Attachment: test.jpg
    (Size: 83.66KB, Downloaded 34 times)
Re: Crash when loading some jpeg files [message #59521 is a reply to message #59508] Mon, 16 January 2023 10:09 Go to previous message
pvictor is currently offline  pvictor
Messages: 67
Registered: December 2015
Member
Well, after waiting for a while, I decided to find this bug myself.
I don't know if it is 100% correct, but it prevents crash on those unhappy images:
uppsrc/plugin/jpg/jpgupp.cpp: 384
- for(int diroff = Exif32(p + 4, end); diroff && begin + diroff < end; diroff = ExifDir(begin, end, diroff, BASE_IFD))
+ for(int diroff = Exif32(p + 4, end); diroff>0 && begin + diroff < end; diroff = ExifDir(begin, end, diroff, BASE_IFD))


Best regards,
Victor
Previous Topic: Single Pixel Wide Straight Lines
Next Topic: BufferPainter Text Clips all text when partial off screen
Goto Forum:
  


Current Time: Fri Mar 29 12:17:46 CET 2024

Total time taken to generate the page: 0.01129 seconds