[marble] [Bug 471339] New: Marble container iterator methods crash

bugzilla_noreply at kde.org bugzilla_noreply at kde.org
Thu Jun 22 15:09:50 BST 2023


https://bugs.kde.org/show_bug.cgi?id=471339

            Bug ID: 471339
           Summary: Marble container iterator methods crash
    Classification: Applications
           Product: marble
           Version: 23.04.2
          Platform: Archlinux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: marble-bugs at kde.org
          Reporter: casqadius at gmail.com
  Target Milestone: ---

Created attachment 159836
  --> https://bugs.kde.org/attachment.cgi?id=159836&action=edit
Sample CMakeLists project to reproduce the crash

SUMMARY

Marble container iterators (e.g. GeoDataLineString::constBegin) usage causes
segmentation fault. 
By default, marble is compiled with QT_STRICT_ITERATORS definition for
non-Windows platforms, which probably results in ODR violation when other
projects without this definition link to the library. 

I believe that's the main reason for this bug as well:
https://bugs.kde.org/show_bug.cgi?id=458555

Compiling the project with explicitly enabled definition fixes described
behaviour. If that define is cricital enough to cause crashes, I expect it to
be mentioned in docs. 


STEPS TO REPRODUCE
1. Create an empty C++ project which links to marble & qt
2. Compile & execute the following code:

#include <marble/GeoDataLineString.h>
#include <marble/GeoDataCoordinates.h>

#include <cassert>
#include <iostream>

int main()
{
  using Marble::GeoDataLineString;
  using Marble::GeoDataCoordinates;

  GeoDataLineString line {};

  for ( size_t i = 0, j = 0; i < 10; ++i, ++j )
    line << GeoDataCoordinates{j + 1.0, j + 2.0, j + 3.0};

  for ( size_t i = 0; i < line.size(); ++i )
  {
    const auto& point = static_cast <const GeoDataLineString&> (line).at(i);

    std::cout << "point " << i
              << ": lon " << point.longitude()
              << " lat " << point.latitude()
              << " alt " << point.altitude();

    std::cout << "\n";
  }

  assert(line.size() > 0);
  assert(line.isEmpty() == false);
  assert(line.constBegin() != line.constEnd());
  assert(line.begin() != line.end());

  return 0;
}


OBSERVED RESULT
Segmentation fault at third assert during the call to line.constBegin():

1 Marble::GeoDataLineString::constBegin() const                        
0x7f94865c47bb 
2 main                                                                        
main.cpp 31 0x563cf7795b4b 

Adding QT_STRICT_ITERATORS definition eliminates the crash. 


EXPECTED RESULT
Successful execution. 

SOFTWARE/OS VERSIONS
Linux: archlinux 6.3.9-arch1-1
Qt Version: 5.15.10+kde+r129-1

ADDITIONAL INFORMATION
The issue is probably non-existent on Windows, since the library is compiled
with strict iterators disabled for this platform by default

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Marble-bugs mailing list