Project

General

Profile

Actions

Bug #13733

open

Dbo::QueryModel and category chart

Added by Andrey Alekseev 22 days ago. Updated 15 days ago.

Status:
Review
Priority:
High
Target version:
Start date:
05/08/2025
Due date:
% Done:

0%

Estimated time:

Description

I have a QueryModel<tuple<string, int, int>> and a category chart
My application instantly crashes

/usr/include/c++/15.1.1/bits/stl_vector.h:1263: constexpr std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::reference std::vector< <template-parameter-1-1>, <template-parameter-1-2> >::operator[](size_type) [with _Tp = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>; _Alloc = std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >; reference = std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

I tried replacing chart with TableView and can confirm that there are no issues with the query itself.

According to the debugger, QueryModel::data is somehow called with invalid index, which is not checked

Actions #1

Updated by Andrey Alekseev 22 days ago

Temporarily solved this by a proxy model

class HotfixProxy : public WIdentityProxyModel {
public:
    cpp17::any data(const WModelIndex &index, ItemDataRole role) const override {
        if ( index.isValid() )
            return WIdentityProxyModel::data(index, role);
        return {};
    }
};
Actions #2

Updated by Matthias Van Ceulebroeck 18 days ago

  • Status changed from New to InProgress
  • Assignee set to Matthias Van Ceulebroeck
  • Target version set to 4.12.2

Hey Andrey,

thanks for the report. This seems to have been in the code for a very long time. The model that converts the original source model to be usable by the charts implementations (WStandardChartProxyModel) retrieved data for an invalid index. For all other models this is fine, and an invalid index can be quickly checked, but this bounds check was not correctly added for the QueryModel.

Actions #3

Updated by Matthias Van Ceulebroeck 17 days ago

  • Status changed from InProgress to Review
  • Assignee deleted (Matthias Van Ceulebroeck)
Actions #4

Updated by Romain Mardulyn 15 days ago

  • Assignee set to Romain Mardulyn
Actions

Also available in: Atom PDF