From 22b9dd834e0d7837dae06048423663f34c4371c9 Mon Sep 17 00:00:00 2001 From: B Stack Date: Fri, 27 Dec 2019 11:27:13 -0500 Subject: fix no_eraseif fuzz --- freefilesync/ffs_no_eraseif.patch | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'freefilesync/ffs_no_eraseif.patch') diff --git a/freefilesync/ffs_no_eraseif.patch b/freefilesync/ffs_no_eraseif.patch index eaaab38..d820cad 100644 --- a/freefilesync/ffs_no_eraseif.patch +++ b/freefilesync/ffs_no_eraseif.patch @@ -1,3 +1,4 @@ +Message: generated with roughly sed -i -r -e 's/std::erase_if/eraseIf/g' $( grep -l -riIE 'std::erase_if\(' ) diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/afs/abstract_impl.h 10.18-2/FreeFileSync/Source/afs/abstract_impl.h --- 10.18-1/FreeFileSync/Source/afs/abstract_impl.h 2019-11-20 16:15:55.823668066 -0500 +++ 10.18-2/FreeFileSync/Source/afs/abstract_impl.h 2019-11-20 17:57:30.555558350 -0500 @@ -10,11 +11,11 @@ diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source //get or create mutex std::weak_ptr& weakPtr = pathLocks[nativePath]; -diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source/afs/gdrive.cpp 10.18-2/FreeFileSync/Source/afs/gdrive.cpp ---- 10.18-1/FreeFileSync/Source/afs/gdrive.cpp 2019-11-20 16:15:55.828668123 -0500 -+++ 10.18-2/FreeFileSync/Source/afs/gdrive.cpp 2019-11-20 17:57:30.556558361 -0500 -@@ -1777,7 +1777,7 @@ - if (it != itemDetails_.end()) +diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-0/FreeFileSync/Source/afs/gdrive.cpp 10.19-1/FreeFileSync/Source/afs/gdrive.cpp +--- 10.18-0/FreeFileSync/Source/afs/gdrive.cpp 2019-11-20 16:15:55.828668123 -0500 ++++ 10.19-1/FreeFileSync/Source/afs/gdrive.cpp 2019-12-27 11:17:35.793612360 -0500 +@@ -1788,7 +1788,7 @@ + if (auto it = itemDetails_.find(itemId); it != itemDetails_.end()) { GoogleItemDetails detailsNew = it->second; - std::erase_if(detailsNew.parentIds, [&](const std::string& id) { return id == parentIdOld; }); @@ -22,7 +23,7 @@ diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source notifyItemUpdate(stateDelta, itemId, detailsNew); } else //conflict!!! -@@ -1792,7 +1792,7 @@ +@@ -1802,7 +1802,7 @@ GoogleItemDetails detailsNew = it->second; detailsNew.itemName = utfTo(newName); @@ -31,7 +32,7 @@ diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source detailsNew.parentIds.push_back(parentIdTo); //not a duplicate notifyItemUpdate(stateDelta, itemId, detailsNew); -@@ -1902,7 +1902,7 @@ +@@ -1911,7 +1911,7 @@ return; //=> avoid misleading changeLog_ entries after Google Drive sync!!! //update change logs (and clean up obsolete entries) @@ -40,7 +41,7 @@ diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source { if (std::shared_ptr iid = weakPtr.lock()) { -@@ -1923,8 +1923,8 @@ +@@ -1932,15 +1932,15 @@ std::vector parentIdsNew = details->parentIds; std::vector parentIdsRemoved = it->second.parentIds; @@ -51,26 +52,25 @@ diff -x '*.swp' -x .git -x '*.orig' -x '*.rej' -Naur 10.18-1/FreeFileSync/Source for (const std::string& parentId : parentIdsNew) folderContents_[parentId].childItems.push_back(it); //new insert => no need for duplicate check -@@ -1933,7 +1933,7 @@ - { - auto itP = folderContents_.find(parentId); - if (itP != folderContents_.end()) + + for (const std::string& parentId : parentIdsRemoved) + if (auto itP = folderContents_.find(parentId); itP != folderContents_.end()) - std::erase_if(itP->second.childItems, [&](auto itChild) { return itChild == it; }); + eraseIf(itP->second.childItems, [&](auto itChild) { return itChild == it; }); - } //if all parents are removed, Google Drive will (recursively) delete the item => don't prematurely do this now: wait for change notifications! -@@ -1955,7 +1955,7 @@ - { - auto itP = folderContents_.find(parentId); - if (itP != folderContents_.end()) + it->second = *details; +@@ -1959,7 +1959,7 @@ + { + for (const std::string& parentId : it->second.parentIds) //1. delete from parent folders + if (auto itP = folderContents_.find(parentId); itP != folderContents_.end()) - std::erase_if(itP->second.childItems, [&](auto itChild) { return itChild == it; }); + eraseIf(itP->second.childItems, [&](auto itChild) { return itChild == it; }); - } + itemDetails_.erase(it); } -@@ -1964,7 +1964,7 @@ - if (itP != folderContents_.end()) +@@ -1967,7 +1967,7 @@ + if (auto itP = folderContents_.find(itemId); itP != folderContents_.end()) { for (auto itChild : itP->second.childItems) //2. delete as parent from child items (don't wait for change notifications of children) - std::erase_if(itChild->second.parentIds, [&](const std::string& id) { return id == itemId; }); -- cgit