Weird behavior of latest sdl_image

hi
lately sdl_image has been acting strange, at least on the iphone

1.2.8 worked fine, even though it had gradient issues (bug 868)
1.2.9 introduced a crash when the loading stage of my application ended
1.2.10 introduced a division by zero at end of the load stage

An unhandled exception occurred at $0000215C :
EDivByZero : Division by zero
$0000215C

I’ve carefully debugged the section in which my application crashes and it’s
100% division free.
Moreover if i use sdl_image 1.2.8 this error doesn’t show up.

what’s going on?
Vittorio

Don’t know if its related, but somebody just reported on the list the
other day that the RWops loader for the UIImage backend would always
escape prematurely. If you are loading RWops instead of a direct file,
you are likely being affected by this bug unless you are using the
patch.

-EricOn 11/19/09, Vittorio G. <vitto.giova at yahoo.it> wrote:

hi
lately sdl_image has been acting strange, at least on the iphone

1.2.8 worked fine, even though it had gradient issues (bug 868)
1.2.9 introduced a crash when the loading stage of my application ended
1.2.10 introduced a division by zero at end of the load stage

An unhandled exception occurred at $0000215C :
EDivByZero : Division by zero
$0000215C

I’ve carefully debugged the section in which my application crashes and it’s
100% division free.
Moreover if i use sdl_image 1.2.8 this error doesn’t show up.

what’s going on?
Vittorio

Not likely, since IMG_Load calls IMG_LoadTyped_RW internally.________________________________
From: ewmailing@gmail.com (Eric Wing)
Subject: Re: [SDL] weird behavior of latest sdl_image

Don’t know if its related, but somebody just reported on the list the
other day that the RWops loader for the UIImage backend would always
escape prematurely. If you are loading RWops instead of a direct file,
you are likely being affected by this bug unless you are using the
patch.

-Eric

I noticed after upgrading sdl_image in snow leopard that all of my 3
component rgb pixels were being padded out to 4 bytes even though they
didn’t have an alpha channel. I have not tested it with the ImageIO
Kit/Framework dohicky disabled however so that is just a guess that it
is the culprit. At least for uploading to opengl this is highly
undesirable since I don’t think there is a glPixelStore command you
can set to tell it my pixels are 4 bytes even though only its only 1
byte per channel rgb.On Fri, Nov 20, 2009 at 10:02 AM, Mason Wheeler wrote:

Not likely, since IMG_Load calls IMG_LoadTyped_RW internally.


From: E. Wing
Subject: Re: [SDL] weird behavior of latest sdl_image

Don’t know if its related, but somebody just reported on the list the
other day that the RWops loader for the UIImage backend would always
escape prematurely. If you are loading RWops instead of a direct file,
you are likely being affected by this bug unless you are using the
patch.

-Eric


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The native OS X backends have separate loading paths now for file vs
RWops for performance reasons.

-EricOn 11/20/09, Mason Wheeler wrote:

Not likely, since IMG_Load calls IMG_LoadTyped_RW internally.

well i’m just using IMG_LoadPNG() and linking against SDL_Image-UIImage
1.2.10
i must have skipped a couple of mails, what patch are you talking about?
do you suggest to load images with rwops?

thanks
VittorioOn Fri, Nov 20, 2009 at 6:11 PM, E. Wing wrote:

Don’t know if its related, but somebody just reported on the list the
other day that the RWops loader for the UIImage backend would always
escape prematurely. If you are loading RWops instead of a direct file,
you are likely being affected by this bug unless you are using the
patch.

-Eric

On 11/19/09, Vittorio G. <vitto.giova at yahoo.it> wrote:

hi
lately sdl_image has been acting strange, at least on the iphone

1.2.8 worked fine, even though it had gradient issues (bug 868)
1.2.9 introduced a crash when the loading stage of my application ended
1.2.10 introduced a division by zero at end of the load stage

An unhandled exception occurred at $0000215C :
EDivByZero : Division by zero
$0000215C

I’ve carefully debugged the section in which my application crashes and
it’s
100% division free.
Moreover if i use sdl_image 1.2.8 this error doesn’t show up.

what’s going on?
Vittorio


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Marie von Ebner-Eschenbachhttp://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html

  • “Even a stopped clock is right twice a day.”

well i’m just using IMG_LoadPNG() and linking against SDL_Image-UIImage
1.2.10
i must have skipped a couple of mails, what patch are you talking about?

[SDL] [SDL_Image]LoadImageFromRWops can’t work on Iphone

But this sounds like a different issue since you are not using RWops.

do you suggest to load images with rwops?

No. Sounds like a different bug.

I don’t have any good ideas at the moment. I recommend you step
through SDL_image with the debugger with your app and see what is
going on.

The new code to un-premultiply alpha does have some division which
might be where the crash is happening.

-EricOn 11/20/09, Vittorio G. <vitto.giova at yahoo.it> wrote:

well since i use pascal i’m having hard times to debug and follow inside
uiimage…
anyways i’m posting here the full error, maybe something will be highlighted

with IMG_LoadPNG the error is

unable to read unknown load command 0x80000022

Previous frame inner to this frame (gdb could not unwind past this frame)
Previous frame inner to this frame (gdb could not unwind past this frame)
(gdb) where
#0 0x00064624 in fpc_raiseexception ()
#1 0x00071b70 in SYSUTILS_RUNERRORTOEXCEPT$LONGINT$POINTER$POINTER ()
#2 0x00066170 in SYSTEM_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER ()
(gdb) c
Continuing.
An unhandled exception occurred at $00022D54 :
EDivByZero : Division by zero

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000008
0x0006c838 in SYSTEM_FILESIZE$file$$INT64 ()
Program received signal: ?EXC_BAD_ACCESS?.

with IMG_LoadPNG_RW and the previous patch the executable fails after
loading 5 images, and this is the error

#0 0x001f444e in LoadImageFromRWops (rw_ops=0x0,

uti_string_hint=0x385649b8) at
/Users/vittorio/hedge.build/iphone-hwengine/SDL-1.3/SDL_image/Xcode_iPhone/…/IMG_UIImage.m:127
#1 0x001f45a2 in IMG_LoadPNG_RW (src=0x0) at
/Users/vittorio/hedge.build/iphone-hwengine/SDL-1.3/SDL_image/Xcode_iPhone/…/IMG_UIImage.m:427
#2 0x00008648 in LOADIMAGE (LOADIMAGE=0x0, FILENAME=@0x2fffe034,
IMAGEFLAGS=0) at
…/…/…/…/…/…/…/Users/vittorio/hedge.build/iphone-hwengine/hwengine3/uStore.pas:988

thanks for any possible further help
VittorioOn Fri, Nov 20, 2009 at 11:00 PM, E. Wing wrote:

On 11/20/09, Vittorio G. <vitto.giova at yahoo.it> wrote:

well i’m just using IMG_LoadPNG() and linking against SDL_Image-UIImage
1.2.10
i must have skipped a couple of mails, what patch are you talking about?

[SDL] [SDL_Image]LoadImageFromRWops can’t work on Iphone

But this sounds like a different issue since you are not using RWops.

do you suggest to load images with rwops?

No. Sounds like a different bug.

I don’t have any good ideas at the moment. I recommend you step
through SDL_image with the debugger with your app and see what is
going on.

The new code to un-premultiply alpha does have some division which
might be where the crash is happening.

-Eric


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Mike Ditka http://www.brainyquote.com/quotes/authors/m/mike_ditka.html -
“If God had wanted man to play soccer, he wouldn’t have given us arms.”

umh i guess this is veeeery old, but i’m posting this for future reference
basically i was compiling sdl_image against the headers of sdl 1.2
instead of 1.3 and that cause some code mixups which eventually led to
the crash
so the fix is: compile sdl_image with latest sdl headers :wink:

VittorioOn Sat, Nov 21, 2009 at 2:06 AM, Vittorio G. <vitto.giova at yahoo.it> wrote:

well since i use pascal i’m having hard times to debug and follow inside
uiimage…
anyways i’m posting here the full error, maybe something will be highlighted

with IMG_LoadPNG the error is

unable to read unknown load command 0x80000022
Previous frame inner to this frame (gdb could not unwind past this frame)
Previous frame inner to this frame (gdb could not unwind past this frame)
(gdb) where
#0? 0x00064624 in fpc_raiseexception ()
#1? 0x00071b70 in SYSUTILS_RUNERRORTOEXCEPT$LONGINT$POINTER$POINTER ()
#2? 0x00066170 in SYSTEM_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER ()
(gdb) c
Continuing.
An unhandled exception occurred at $00022D54 :
EDivByZero : Division by zero

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000008
0x0006c838 in SYSTEM_FILESIZE$file$$INT64 ()
Program received signal:? ?EXC_BAD_ACCESS?.

with IMG_LoadPNG_RW and the previous patch the executable fails after
loading 5 images, and this is the error

#0? 0x001f444e in LoadImageFromRWops (rw_ops=0x0,
uti_string_hint=0x385649b8) at
/Users/vittorio/hedge.build/iphone-hwengine/SDL-1.3/SDL_image/Xcode_iPhone/…/IMG_UIImage.m:127
#1? 0x001f45a2 in IMG_LoadPNG_RW (src=0x0) at
/Users/vittorio/hedge.build/iphone-hwengine/SDL-1.3/SDL_image/Xcode_iPhone/…/IMG_UIImage.m:427
#2? 0x00008648 in LOADIMAGE (LOADIMAGE=0x0, FILENAME=@0x2fffe034,
IMAGEFLAGS=0) at
…/…/…/…/…/…/…/Users/vittorio/hedge.build/iphone-hwengine/hwengine3/uStore.pas:988

thanks for any possible further help
Vittorio

On Fri, Nov 20, 2009 at 11:00 PM, E. Wing wrote:

On 11/20/09, Vittorio G. <vitto.giova at yahoo.it> wrote:

well i’m just using IMG_LoadPNG() and linking against SDL_Image-UIImage
1.2.10
i must have skipped a couple of mails, what patch are you talking about?

[SDL] [SDL_Image]LoadImageFromRWops can’t work on Iphone

But this sounds like a different issue since you are not using RWops.

do you suggest to load images with rwops?

No. Sounds like a different bug.

I don’t have any good ideas at the moment. I recommend you step
through SDL_image with the debugger with your app and see what is
going on.

The new code to un-premultiply alpha does have some division which
might be where the crash is happening.

-Eric


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Mike Ditka ?- “If God had wanted man to play soccer, he wouldn’t have given
us arms.”