Project

General

Profile

Actions

Bug #13733

closed
AA MV

Dbo::QueryModel and category chart

Bug #13733: Dbo::QueryModel and category chart

Added by Andrey Alekseev over 1 year ago. Updated 7 months ago.

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

100%

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

AA Updated by Andrey Alekseev over 1 year ago Actions #1

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 {};
    }
};

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #2

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

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #3

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

RM Updated by Romain Mardulyn over 1 year ago Actions #4

  • Assignee set to Romain Mardulyn

MV Updated by Matthias Van Ceulebroeck 11 months ago Actions #5

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Romain Mardulyn to Matthias Van Ceulebroeck
  • % Done changed from 0 to 100

RM Updated by Romain Mardulyn 7 months ago Actions #6

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: PDF Atom