sky
2009-01-14 08:57:14 UTC
I wrote a very simple program to display a GIF file via GDI+
but it always output a exception when I debug it
the following is the source code(C#) and the call stack(WinDbg)
Image image = Image.FromFile("c:\\a1.gif");
int idx = 0;
private void button1_Click(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
Point p = new Point(20, 20);
g.DrawImage(image, p);
g.Dispose();
idx++;
System.Drawing.Imaging.FrameDimension fd = new
System.Drawing.Imaging.FrameDimension(image.FrameDimensionsList[0]);
if (idx >= image.GetFrameCount(fd)) idx = 0;
image.SelectActiveFrame(fd, idx);
}
Any hintwill be greate appreciated!
// WinDbg call stack
gdiplus!LZWDecompressor::FHandleNext+0x10a
gdiplus!GpGifCodec::ProcessImageChunk+0x935
gdiplus!GpGifCodec::DoDecode+0x1d6
gdiplus!GpGifCodec::Decode+0x91
gdiplus!GpDecodedImage::InternalPushIntoSink+0x2e
gdiplus!GpDecodedImage::PushIntoSink+0x2e
gdiplus!GpMemoryBitmap::InitImageBitmap+0xcc
gdiplus!GpMemoryBitmap::CreateFromImage+0x49
gdiplus!CopyOnWriteBitmap::SelectActiveFrame+0xa7
gdiplus!GpBitmap::SelectActiveFrame+0x22
gdiplus!GdipImageSelectActiveFrame+0x61
// the result in Command window
CommandLine: C:\WindowsApplication1.exe
Symbol search path is:
srv*D:\Symbols\*http://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 00400000 00408000 WindowsApplication1.exe
ModLoad: 7c920000 7c9b4000 ntdll.dll
ModLoad: 79000000 79045000 C:\WINDOWS\system32\mscoree.dll
ModLoad: 7c800000 7c91d000 C:\WINDOWS\system32\KERNEL32.dll
(adc.b0c): Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffdd000 ecx=00000001 edx=00000002 esi=00241f48
edi=00241eb4
eip=7c921230 esp=0012fb20 ebp=0012fc94 iopl=0 nv up ei pl nz na po
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000202
ntdll!DbgBreakPoint:
7c921230 cc int 3
0:000> g
ModLoad: 77da0000 77e49000 C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e50000 77ee2000 C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fc0000 77fd1000 C:\WINDOWS\system32\Secur32.dll
ModLoad: 77f40000 77fb6000 C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 77ef0000 77f38000 C:\WINDOWS\system32\GDI32.dll
ModLoad: 77d10000 77d9f000 C:\WINDOWS\system32\USER32.dll
ModLoad: 77be0000 77c38000 C:\WINDOWS\system32\msvcrt.dll
ModLoad: 76300000 7631d000 C:\WINDOWS\system32\IMM32.DLL
ModLoad: 62c20000 62c29000 C:\WINDOWS\system32\LPK.DLL
ModLoad: 73fa0000 7400b000 C:\WINDOWS\system32\USP10.dll
ModLoad: 79e70000 7a3d1000
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
ModLoad: 78130000 781cb000
C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700\MSVCR80.dll
ModLoad: 7d590000 7dd83000 C:\WINDOWS\system32\shell32.dll
ModLoad: 77180000 77283000
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
ModLoad: 5d170000 5d20a000 C:\WINDOWS\system32\comctl32.dll
ModLoad: 60340000 60348000
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\culture.dll
ModLoad: 790c0000 79ba8000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\05ea9a15deafba439c2310d567c238a3\mscorlib.ni.dll
ModLoad: 76990000 76acd000 C:\WINDOWS\system32\ole32.dll
ModLoad: 5adc0000 5adf7000 C:\WINDOWS\system32\uxtheme.dll
ModLoad: 74680000 746cb000 C:\WINDOWS\system32\MSCTF.dll
ModLoad: 79060000 790b3000
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll
ModLoad: 7a440000 7abfe000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\5e097525f7cde84189d11ca01edb7c8a\System.ni.dll
ModLoad: 7ade0000 7af74000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Drawing\29b91bd046189a43b459360fd79e49d5\System.Drawing.ni.dll
ModLoad: 7afd0000 7bc56000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\2583b8a9aad76047a5097c79156a341f\System.Windows.Forms.ni.dll
ModLoad: 4ec50000 4edf6000
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.5581_x-ww_dfbc4fc4\gdiplus.dll
ModLoad: 77bd0000 77bd8000 C:\WINDOWS\system32\version.dll
ModLoad: 73640000 7366e000 C:\WINDOWS\system32\msctfime.ime
(adc.b0c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00203930 ebx=00000002 ecx=01200001 edx=00203930 esi=00f054f0
edi=00000002
eip=4ed9b280 esp=0012eafc ebp=0012eb24 iopl=0 nv up ei pl nz na po
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00010202
gdiplus!LZWDecompressor::FHandleNext+0x10a:
4ed9b280 8801 mov byte ptr [ecx],al
ds:0023:01200001=??
but it always output a exception when I debug it
the following is the source code(C#) and the call stack(WinDbg)
Image image = Image.FromFile("c:\\a1.gif");
int idx = 0;
private void button1_Click(object sender, EventArgs e)
{
Graphics g = this.CreateGraphics();
Point p = new Point(20, 20);
g.DrawImage(image, p);
g.Dispose();
idx++;
System.Drawing.Imaging.FrameDimension fd = new
System.Drawing.Imaging.FrameDimension(image.FrameDimensionsList[0]);
if (idx >= image.GetFrameCount(fd)) idx = 0;
image.SelectActiveFrame(fd, idx);
}
Any hintwill be greate appreciated!
// WinDbg call stack
gdiplus!LZWDecompressor::FHandleNext+0x10a
gdiplus!GpGifCodec::ProcessImageChunk+0x935
gdiplus!GpGifCodec::DoDecode+0x1d6
gdiplus!GpGifCodec::Decode+0x91
gdiplus!GpDecodedImage::InternalPushIntoSink+0x2e
gdiplus!GpDecodedImage::PushIntoSink+0x2e
gdiplus!GpMemoryBitmap::InitImageBitmap+0xcc
gdiplus!GpMemoryBitmap::CreateFromImage+0x49
gdiplus!CopyOnWriteBitmap::SelectActiveFrame+0xa7
gdiplus!GpBitmap::SelectActiveFrame+0x22
gdiplus!GdipImageSelectActiveFrame+0x61
// the result in Command window
CommandLine: C:\WindowsApplication1.exe
Symbol search path is:
srv*D:\Symbols\*http://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 00400000 00408000 WindowsApplication1.exe
ModLoad: 7c920000 7c9b4000 ntdll.dll
ModLoad: 79000000 79045000 C:\WINDOWS\system32\mscoree.dll
ModLoad: 7c800000 7c91d000 C:\WINDOWS\system32\KERNEL32.dll
(adc.b0c): Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffdd000 ecx=00000001 edx=00000002 esi=00241f48
edi=00241eb4
eip=7c921230 esp=0012fb20 ebp=0012fc94 iopl=0 nv up ei pl nz na po
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000202
ntdll!DbgBreakPoint:
7c921230 cc int 3
0:000> g
ModLoad: 77da0000 77e49000 C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e50000 77ee2000 C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fc0000 77fd1000 C:\WINDOWS\system32\Secur32.dll
ModLoad: 77f40000 77fb6000 C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 77ef0000 77f38000 C:\WINDOWS\system32\GDI32.dll
ModLoad: 77d10000 77d9f000 C:\WINDOWS\system32\USER32.dll
ModLoad: 77be0000 77c38000 C:\WINDOWS\system32\msvcrt.dll
ModLoad: 76300000 7631d000 C:\WINDOWS\system32\IMM32.DLL
ModLoad: 62c20000 62c29000 C:\WINDOWS\system32\LPK.DLL
ModLoad: 73fa0000 7400b000 C:\WINDOWS\system32\USP10.dll
ModLoad: 79e70000 7a3d1000
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
ModLoad: 78130000 781cb000
C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700\MSVCR80.dll
ModLoad: 7d590000 7dd83000 C:\WINDOWS\system32\shell32.dll
ModLoad: 77180000 77283000
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
ModLoad: 5d170000 5d20a000 C:\WINDOWS\system32\comctl32.dll
ModLoad: 60340000 60348000
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\culture.dll
ModLoad: 790c0000 79ba8000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\05ea9a15deafba439c2310d567c238a3\mscorlib.ni.dll
ModLoad: 76990000 76acd000 C:\WINDOWS\system32\ole32.dll
ModLoad: 5adc0000 5adf7000 C:\WINDOWS\system32\uxtheme.dll
ModLoad: 74680000 746cb000 C:\WINDOWS\system32\MSCTF.dll
ModLoad: 79060000 790b3000
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll
ModLoad: 7a440000 7abfe000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\5e097525f7cde84189d11ca01edb7c8a\System.ni.dll
ModLoad: 7ade0000 7af74000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Drawing\29b91bd046189a43b459360fd79e49d5\System.Drawing.ni.dll
ModLoad: 7afd0000 7bc56000
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\2583b8a9aad76047a5097c79156a341f\System.Windows.Forms.ni.dll
ModLoad: 4ec50000 4edf6000
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.5581_x-ww_dfbc4fc4\gdiplus.dll
ModLoad: 77bd0000 77bd8000 C:\WINDOWS\system32\version.dll
ModLoad: 73640000 7366e000 C:\WINDOWS\system32\msctfime.ime
(adc.b0c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00203930 ebx=00000002 ecx=01200001 edx=00203930 esi=00f054f0
edi=00000002
eip=4ed9b280 esp=0012eafc ebp=0012eb24 iopl=0 nv up ei pl nz na po
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00010202
gdiplus!LZWDecompressor::FHandleNext+0x10a:
4ed9b280 8801 mov byte ptr [ecx],al
ds:0023:01200001=??