Skip to content

Avoid UB from invalidated iterators

Adriaan de Groot requested to merge work/adridg/memory-issues into master

This code uses a range-based for-loop over m_filterList, and in the loop appends to the list. If the list reallocates, though, the range becomes invalid and we end up reading invalid memory. The mimetype names aren't interesting to call mimeTypeForName() on again, so push those names onto a new list and then append that in one go after processing m_filterList once.

Merge request reports