Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage::fromData SEGV
Forum Updated to NodeBB v4.3 + New Features

QImage::fromData SEGV

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 4 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C ChrisW67

    @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.

    C Offline
    C Offline
    Creaperdown
    wrote on last edited by
    #8

    @ChrisW67 Is there a way that I could test if that buffer contains valid data?

    JonBJ C 2 Replies Last reply
    0
    • C Creaperdown

      @ChrisW67 Is there a way that I could test if that buffer contains valid data?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #9

      @Creaperdown
      You have shown/claimed that this line is failing:

      if (version != JPEG_LIB_VERSION)

      From the stack trace where does the value of version passed into this function emanate from?

      Or are you not saying this is the cause of the SEGV? If that comes from accessing *cinfo that is a different issue.

      C 2 Replies Last reply
      0
      • JonBJ JonB

        @Creaperdown
        You have shown/claimed that this line is failing:

        if (version != JPEG_LIB_VERSION)

        From the stack trace where does the value of version passed into this function emanate from?

        Or are you not saying this is the cause of the SEGV? If that comes from accessing *cinfo that is a different issue.

        C Offline
        C Offline
        Creaperdown
        wrote on last edited by
        #10

        @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.

        JonBJ 1 Reply Last reply
        0
        • C Creaperdown

          @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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #11

          @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 that if statement? Is *cinfo implicated [oic, cinfo is passed to ERREXIT2] and/or is structsize an expected size?

          C 1 Reply Last reply
          0
          • C Creaperdown

            @ChrisW67 Is there a way that I could test if that buffer contains valid data?

            C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #12

            @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?

            C 1 Reply Last reply
            0
            • C ChrisW67

              @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?

              C Offline
              C Offline
              Creaperdown
              wrote on last edited by
              #13

              @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 version in the above snippet is 80 and JPEG_LIB_VERSION is 90.

              1 Reply Last reply
              0
              • JonBJ JonB

                @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 that if statement? Is *cinfo implicated [oic, cinfo is passed to ERREXIT2] and/or is structsize an expected size?

                C Offline
                C Offline
                Creaperdown
                wrote on last edited by
                #14

                @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);
                
                1 Reply Last reply
                0
                • JonBJ JonB

                  @Creaperdown
                  You have shown/claimed that this line is failing:

                  if (version != JPEG_LIB_VERSION)

                  From the stack trace where does the value of version passed into this function emanate from?

                  Or are you not saying this is the cause of the SEGV? If that comes from accessing *cinfo that is a different issue.

                  C Offline
                  C Offline
                  Creaperdown
                  wrote on last edited by
                  #15

                  @JonB And now i get a stack trace
                  e42e39a6-24f5-45fe-bb7c-1d36dedd1551-image.png

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Creaperdown
                    wrote on last edited by
                    #16

                    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.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Creaperdown
                      wrote on last edited by
                      #17

                      I still didn't find a solution to this, does anyone have another idea?

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved