Revision 1319753

Go back to digest for 14th October 2012

Bug Fixes in Educational

Peter Kümmel committed changes in /branches/work/kst/portto4/kst/src/datasources/ascii:

QVarLengthArray throws when out of memory

also work around a Qt bug, C&P from merge request:

OOM: don't overwrite valid pointer with NULL

After a exception is thrown in resize QVarLengthArray has an
invalid state with ptr == 0. On the next resize call when qMalloc
returns a valid pointer oldPtr is 0 and it could crash in
qMemCopy because the pointer to the source is 0.

For example:

int GB = 1024*1024*1024;
while (qMalloc(GB) != 0) {}

QVarLengthArray<char, 0> arr;
try {
arr.resize(GB);
} catch(const std::bad_alloc&) {
arr.resize(1024);
}

File Changes

Modified 2 files
  • /branches/work/kst/portto4/kst/src/datasources/ascii
  •   /asciisource.cpp
  •   /asciisource.h
2 files changed in total