icinga2/test
Julian Brost 784867b3f7 Avoid undefined behavior in string/vector_move test
vec[1] is equivalent to vec[vec.size()] at that point and thus not a valid
element of the vector, making the use of operator[] undefined behavior here.
With some compiler flags (like those used in package builds on RHEL and
similar), the compiler (rightfully) aborts the program on this out of bounds
access:

     68/178 Test  #68: base-base_string/vector_move ............................................***Failed    0.01 sec
    /usr/include/c++/14/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = icinga::String; _Alloc = std::allocator<icinga::String>; reference = icinga::String&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
    Running 1 test case...
    unknown location(0): fatal error: in "base_string/vector_move": signal: SIGABRT (application abort requested)
    /builds/packages/icinga2/packaging/fedora/41/BUILD/icinga2-2.14.5+467.g206d7cda1-build/icinga2-2.14.5+467.g206d7cda1/test/base-string.cpp(120): last checkpoint
    *** 1 failure is detected in the test module "icinga2"

This commit fixes this by taking the indirection through .data() and using
plain pointer arithmetic instead.
2025-03-10 09:28:33 +01:00
..
config Remove unnecessary imports from unit test config 2016-08-28 10:41:46 +02:00
livestatus Livestatus: Fix "class" filter for log table 2015-11-26 19:15:54 +01:00
base-array.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-base64.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-convert.cpp Convert::ToString(double): handle integral values too large for long long correctly 2021-04-27 17:31:50 +02:00
base-dictionary.cpp Dictionary: Make sure underlaying map is ordered 2021-11-12 13:34:57 +01:00
base-fifo.cpp Stream#Read(): remove de facto unused param allow_partial 2023-07-13 16:55:48 +02:00
base-io-engine.cpp Move Timeout instances from heap to stack 2025-01-07 18:20:50 +01:00
base-json.cpp JsonEncode(): encode non-[]/{} objects as strings, not null 2021-04-30 15:49:52 +02:00
base-match.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-netstring.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-object-packer.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-object.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-serialize.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-shellescape.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-stacktrace.cpp Stacktrace test: try to prevent inlining even harder 2021-03-01 16:08:06 +01:00
base-stream.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
base-string.cpp Avoid undefined behavior in string/vector_move test 2025-03-10 09:28:33 +01:00
base-timer.cpp Use Timer::Create() instead of new Timer() 2023-04-04 10:35:20 +02:00
base-tlsutility.cpp Test IsCertUptodate() and IsCaUptodate() 2023-12-18 15:28:11 +01:00
base-type.cpp Add basic test cases for Type::GetConfigTypesSortedByLoadDependencies() 2024-09-20 16:18:12 +02:00
base-utility.cpp tests: fix FormatDateTime with 32-bit time_t 2025-02-05 11:21:15 +01:00
base-value.cpp Make base_value/format test easier to understand 2021-05-31 17:28:35 +02:00
CMakeLists.txt Value: Add a specialized rvalue reference of Get() 2025-03-07 10:16:31 +01:00
config-apply.cpp Tests: config_apply/gettargetservices_*: use BOOST_CHECK_EQUAL_COLLECTIONS() 2023-12-18 16:01:31 +01:00
config-ops.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-checkable-fixture.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-checkable-flapping.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-checkresult.cpp Checkable: Add test for state notifications after a suppression ends 2022-03-03 14:25:23 +01:00
icinga-dependencies.cpp Repair unit tests 2023-02-21 17:49:26 +01:00
icinga-legacytimeperiod.cpp Utility::FormatDateTime(): provide an overload for tm* 2024-08-23 12:48:50 +02:00
icinga-macros.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icinga-notification.cpp Notification#BeginExecuteNotification(): on recovery clear last_notified_state_per_user 2023-12-13 13:21:22 +01:00
icinga-perfdata.cpp Reject infinite performance data values 2025-01-09 11:46:34 +01:00
icingaapplication-fixture.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
icingaapplication-fixture.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
livestatus-fixture.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
livestatus.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
methods-pluginnotificationtask.cpp PluginNotificationTask::ScriptFunc(): on Linux truncate output and comment 2023-12-19 12:21:03 +01:00
remote-configpackageutility.cpp De-couple package and stage name validation 2021-08-02 15:40:14 +02:00
remote-url.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
test-runner.cpp Tests: _Exit() in main() 2019-07-23 12:14:06 +02:00