From 3f367c4c37e08b2ca1b1a5adb3381d30b4a46e82 Mon Sep 17 00:00:00 2001 From: ArduinoidIOT <40311259+ArduinoidIOT@users.noreply.github.com> Date: Wed, 25 May 2022 08:33:48 +0530 Subject: [PATCH 1/2] Fix segmentation fault in erase method --- VTIL-Common/util/detached_queue.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VTIL-Common/util/detached_queue.hpp b/VTIL-Common/util/detached_queue.hpp index 0f22dc98..1f46dd29 100644 --- a/VTIL-Common/util/detached_queue.hpp +++ b/VTIL-Common/util/detached_queue.hpp @@ -169,10 +169,10 @@ namespace vtil { std::lock_guard _g( *this ); - if ( k->prev ) k->prev->next = k->next; + if ( k->prev && k->prev != key::invalid_value) k->prev->next = k->next; else head = k->next; - if ( k->next ) k->next->prev = k->prev; + if ( k->next && k->next != key::invalid_value) k->next->prev = k->prev; else tail = k->prev; k->prev = key::invalid_value; From dafdf74ec517fb83252ba0f4d4df87c2faf0f2e8 Mon Sep 17 00:00:00 2001 From: ArduinoidIOT <40311259+ArduinoidIOT@users.noreply.github.com> Date: Wed, 25 May 2022 09:01:48 +0530 Subject: [PATCH 2/2] found another one --- VTIL-Common/util/detached_queue.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VTIL-Common/util/detached_queue.hpp b/VTIL-Common/util/detached_queue.hpp index 1f46dd29..cc22af05 100644 --- a/VTIL-Common/util/detached_queue.hpp +++ b/VTIL-Common/util/detached_queue.hpp @@ -146,7 +146,7 @@ namespace vtil k->prev = nullptr; k->next = head; - if ( head ) head->prev = k; + if ( head && head != key::invalid_value) head->prev = k; if ( !tail ) tail = k; head = k; list_size++;