GNOME Bugzilla – Bug 619991
Access violation writing location
Last modified: 2018-05-22 13:11:08 UTC
when if (Ok != (status = GdipBitmapGetPixel (bitmap, x, y, &pixel))) {...} will happen First-chance exception at 0x4b03b280 in gtk-demo.exe: 0xC0000005: Access violation writing location 0x01c6000e.
Created attachment 162252 [details] Access violation in VC9
in gtk-demo sample code
(In reply to comment #2) > in gtk-demo sample code http://support.microsoft.com/?scid=kb;en-us;901026&x=20&y=13 its a microsoft Gdiplus.dll bug
Hmm, huh? Is there a bug somewhere in GTK+ or not? Why is this bug report marked "fixed"? (If there is a bug elsewhere and no workaround is possible, "NOTGNOME" would be a better resolution. But ideally we should try to come up with a workaround.) What does "PrivateFontCollection" (mentioned in the link to support.microsoft.com above) has to do with this?
The bug is from microsoft not GTK, i install hotfix then all done~(In reply to comment #4) > Hmm, huh? Is there a bug somewhere in GTK+ or not? Why is this bug report > marked "fixed"? (If there is a bug elsewhere and no workaround is possible, > "NOTGNOME" would be a better resolution. But ideally we should try to come up > with a workaround.) What does "PrivateFontCollection" (mentioned in the link to > support.microsoft.com above) has to do with this? The bug is from microsoft not GTK, i install hotfix then all done~
But we can't really expect people to know about such hotfixes. It is not correct to require people to have non-mandatory fixes installed. Re-opening the bug. Is there no way to add a workaround to the GTK+ code? That needs to be figured out. Anyway, do you have a complete but minimal sample program that causes the access violation (on a system without the gdipus hotfix)? Please attach it. (As a single source file, thanks. No binaries, no zip or other archives.)
// GDItest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #define WINGDIPAPI __stdcall typedef struct _GpImage GpImage; typedef struct _GpBitmap GpBitmap; typedef struct _GpGraphics GpGraphics; struct _GdiplusStartupInput { unsigned int GdiplusVersion; void* DebugEventCallback; int SuppressBackgroundThread; int SuppressExternalCodecs; }; typedef struct _GdiplusStartupInput GdiplusStartupInput; enum _Status { Ok = 0, GenericError = 1, InvalidParameter = 2, OutOfMemory = 3, ObjectBusy = 4, InsufficientBuffer = 5, NotImplemented = 6, Win32Error = 7, WrongState = 8, Aborted = 9, FileNotFound = 10, ValueOverflow = 11, AccessDenied = 12, UnknownImageFormat = 13, FontFamilyNotFound = 14, FontStyleNotFound = 15, NotTrueTypeFont = 16, UnsupportedGdiplusVersion = 17, GdiplusNotInitialized = 18, PropertyNotFound = 19, PropertyNotSupported = 20, ProfileNotFound = 21 }; typedef enum _Status GpStatus; typedef void* gpointer; typedef void* gconstpointer; typedef unsigned long ARGB; typedef GpStatus (WINGDIPAPI* GdiplusStartupFunc) (gpointer, const gpointer, gpointer); typedef GpStatus (WINGDIPAPI* GdiplusShutdownFunc) (gpointer); typedef GpStatus (WINGDIPAPI* GdipCreateBitmapFromStreamFunc) (gpointer, GpBitmap**); typedef GpStatus (WINGDIPAPI* GdipCreateBitmapFromFileFunc) (WCHAR*, GpBitmap**); typedef GpStatus (WINGDIPAPI* GdipBitmapGetPixelFunc) (GpBitmap*, int x, int y, ARGB*); typedef GpStatus (WINGDIPAPI* GdipGetImageWidthFunc) (GpImage*, unsigned int*); typedef GpStatus (WINGDIPAPI* GdipGetImageHeightFunc) (GpImage*, unsigned int*); GdiplusStartupFunc GdiplusStartup; GdiplusShutdownFunc GdiplusShutdown; GdipCreateBitmapFromStreamFunc GdipCreateBitmapFromStream; GdipCreateBitmapFromFileFunc GdipCreateBitmapFromFile; GdipBitmapGetPixelFunc GdipBitmapGetPixel; GdipGetImageWidthFunc GdipGetImageWidth; GdipGetImageHeightFunc GdipGetImageHeight; HINSTANCE gdipluslib = NULL; int gdip_init(void) { GdiplusStartupInput input; long gdiplusToken = 0; if (!gdipluslib) gdipluslib = LoadLibrary ("gdiplus.dll"); else return TRUE; /* gdip_init() is idempotent */ GdiplusStartup = (GdiplusStartupFunc)GetProcAddress(gdipluslib, "GdiplusStartup"); GdiplusShutdown = (GdiplusShutdownFunc)GetProcAddress(gdipluslib, "GdiplusShutdown"); GdipBitmapGetPixel = (GdipBitmapGetPixelFunc)GetProcAddress(gdipluslib, "GdipBitmapGetPixel"); GdipCreateBitmapFromStream = (GdipCreateBitmapFromStreamFunc)GetProcAddress(gdipluslib, "GdipCreateBitmapFromStream"); GdipCreateBitmapFromFile = (GdipCreateBitmapFromFileFunc)GetProcAddress(gdipluslib, "GdipCreateBitmapFromFile"); input.GdiplusVersion = 1; input.DebugEventCallback = NULL; input.SuppressBackgroundThread = input.SuppressExternalCodecs = FALSE; return (GdiplusStartup (&gdiplusToken, &input, NULL) == 0 ? TRUE : FALSE); } int _tmain(int argc, _TCHAR* argv[]) { ARGB pixel; unsigned __int64 size64; //ULARGE_INTEGER size64; int status; FILE* gifp; HGLOBAL hg = NULL; IStream* stream = NULL; GpBitmap* bitmap = NULL; status = gdip_init(); status = fopen_s(&gifp,"rgb.gif","rb"); hg = GlobalAlloc (GPTR, 6427); fread(hg,1,6427,gifp); size64 = 6427; //size64.QuadPart = 6427; CreateStreamOnHGlobal (hg, FALSE, (LPSTREAM *)&stream); stream->SetSize(*(ULARGE_INTEGER*)&size64); status = GdipCreateBitmapFromStream (stream, &bitmap); //status = GdipCreateBitmapFromFile(L"rgb.gif", &bitmap); pixel = 0; status = GdipBitmapGetPixel (bitmap, 0, 0, &pixel); fclose(gifp); GdiplusShutdown(gdipluslib); status = FreeLibrary( gdipluslib ); return 0; } If gdiplus.dll have bug then status = GdipBitmapGetPixel (bitmap, 0, 0, &pixel); will happend Access violation writing location in debug message windows in VC
Please add my email & msn : fatalfeel@hotmail.com If could please friend list in msn (In reply to comment #6) > But we can't really expect people to know about such hotfixes. It is not > correct to require people to have non-mandatory fixes installed. Re-opening the > bug. Is there no way to add a workaround to the GTK+ code? That needs to be > figured out. > Anyway, do you have a complete but minimal sample program that causes the > access violation (on a system without the gdipus hotfix)? Please attach it. (As > a single source file, thanks. No binaries, no zip or other archives.)
I don't use msn, whatever it is, or any other "social media" either, if it's some such. I am basically anti-social;)
(In reply to comment #9) > I don't use msn, whatever it is, or any other "social media" either, if it's > some such. I am basically anti-social;) msn skype yahoo ... anyone?
I doubt you will find anyone wanting to talk about this using some private person-to-person real-time media. bugzilla is used for a reason, to keep the dicsussion public and non-real-time.
ha ha ha ha u are my bug in my body... thanks
Please don't close the bug if it is obvious that there *is* a problem that we would need to come up with a workaround for. Especially don't claim it would have been "fixed". "wontfix" might be more appropriate in this case, but let's not be that pessimistic yet. (Having a bug open doesn't mean it will ever be fixed, of course.)
I wonder if this has been fixed now in the GDI+-based gdk-pixbuf loaders, if that is what this somewhat strange bug is about. At least some GDI+ problem was fixed in them.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/25.