Results 1 to 11 of 11

Thread: semi-random crashes in QByteArray::data()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    248
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    29
    Thanked 15 Times in 14 Posts

    Default semi-random crashes in QByteArray::data()

    Alright, i am reading into a QByteArray like this:


    Qt Code:
    1. if(myArray.size() < size)
    2. myArray.resize(size);
    3.  
    4. __memcpy_dgsint(dataArray.data(), start, size);
    To copy to clipboard, switch view to plain text mode 

    then, some seconds after doing that, i access the read data:

    Qt Code:
    1. char* r = myArray.data();
    To copy to clipboard, switch view to plain text mode 


    this works just fine most of the time ("start" is sanitized in the second sample).
    Howver, i get crashes with a certain, very specific input file.
    In such a case, the crash happens inside myArray.data(), inside internal QByteArray methods, inside a memcpy() function.
    See the callstack here:



    And the exception:
    First-chance exception at 0x1026ed6a (msvcr90d.dll) in x.exe: 0xC0000005: Access violation reading location 0x00a99f00.
    Unhandled exception at 0x1026ed6a (msvcr90d.dll) in x.exe: 0xC0000005: Access violation reading location 0x00a99f00.

    The size-values we are talking about here arent huge - ~500 bytes maybe.

    This seems all very wired to me. I collected some data and there are no extraordinary values involved when it crashes. Rather, the same call with the same size value succeeded several dozen times before, and then
    QByteArray decides to wiredly call some realloc functon and crash.

    any ideas why?


    winxpsp3, vs2008 + Qt484
    Attached Images Attached Images

Similar Threads

  1. Replies: 1
    Last Post: 8th November 2012, 23:23
  2. Replies: 4
    Last Post: 21st October 2012, 19:04
  3. How to debug random crashes?
    By Gunnar in forum Qt Programming
    Replies: 5
    Last Post: 21st November 2011, 21:25
  4. QSerial problem:receives random data
    By omegaKnot in forum Qt Programming
    Replies: 5
    Last Post: 27th May 2011, 09:32
  5. Replies: 1
    Last Post: 7th April 2010, 16:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.