QImage::fromData SEGV
-
@SGaist The OP is using QImage::fromData() and the result is a crash in the code embedded/called within the plugin. IIRC this JPEG code may be embedded in Qt or from a system library.
My money is on passing an invalid buffer or size to the QImage function in the first place. "Works just fine on a different machine" is not a good reference if, for example, the buffer is a deleted temporary object that gets overwritten, or written to by an unsynchronised thread... these all come down to matters of timing and system load.
@ChrisW67 Is there a way that I could test if that buffer contains valid data?
-
@ChrisW67 Is there a way that I could test if that buffer contains valid data?
@Creaperdown
You have shown/claimed that this line is failing:if (version != JPEG_LIB_VERSION)From the stack trace where does the value of
versionpassed into this function emanate from?Or are you not saying this is the cause of the SEGV? If that comes from accessing
*cinfothat is a different issue. -
@Creaperdown
You have shown/claimed that this line is failing:if (version != JPEG_LIB_VERSION)From the stack trace where does the value of
versionpassed into this function emanate from?Or are you not saying this is the cause of the SEGV? If that comes from accessing
*cinfothat is a different issue.@JonB Sadly QtCreator does not show me a stack trace. I only get the calling functions, then question marks right to the function I shared above.
-
@JonB Sadly QtCreator does not show me a stack trace. I only get the calling functions, then question marks right to the function I shared above.
@Creaperdown
Ah, OK. That is not a Creator limitation, it's gdb and the (lack of) source code/debug info.If you get a SEGV rather than the
ERREXIT2(...)in your original post, what is, say, the next line after thatifstatement? Is*cinfoimplicated [oic,cinfois passed toERREXIT2] and/or isstructsizean expected size? -
@ChrisW67 Is there a way that I could test if that buffer contains valid data?
@Creaperdown Where does the data come from? How are you passing it to QImage::fromData()? Are there threads active in your program, or is all this happening in the main thread?
-
@Creaperdown Where does the data come from? How are you passing it to QImage::fromData()? Are there threads active in your program, or is all this happening in the main thread?
@ChrisW67 I am downloading the data from my server where I have previously uploaded it to. Right now I noticed that another part of my application, that has been working just fine before, fails because of the same error. I managed to find the
versionin the above snippet is80andJPEG_LIB_VERSIONis 90. -
@Creaperdown
Ah, OK. That is not a Creator limitation, it's gdb and the (lack of) source code/debug info.If you get a SEGV rather than the
ERREXIT2(...)in your original post, what is, say, the next line after thatifstatement? Is*cinfoimplicated [oic,cinfois passed toERREXIT2] and/or isstructsizean expected size?@JonB it steps into
ERREXIT2(). The next line would be:GLOBAL(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize) { int i; /* Guard against version mismatches between library and caller. */ cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */ if (version != JPEG_LIB_VERSION) ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version); if (structsize != SIZEOF(struct jpeg_decompress_struct)) ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE, (int) SIZEOF(struct jpeg_decompress_struct), (int) structsize); -
@Creaperdown
You have shown/claimed that this line is failing:if (version != JPEG_LIB_VERSION)From the stack trace where does the value of
versionpassed into this function emanate from?Or are you not saying this is the cause of the SEGV? If that comes from accessing
*cinfothat is a different issue.@JonB And now i get a stack trace

-
Ok, now I have done some system updates and jpegs work fine in debug mode, but running the application in release mode still causes the same crash.
-
I still didn't find a solution to this, does anyone have another idea?