File: upstream_6a78dabc_windowswalker-walk-right-over-errors.patch

package info (click to toggle)
filelight 4%3A25.04.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: cpp: 2,775; xml: 480; makefile: 10; sh: 3
file content (34 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 6a78dabc4ddf9053543d70c7f07c533c8e5020e2 Mon Sep 17 00:00:00 2001
From: Harald Sitter <sitter@kde.org>
Date: Fri, 18 Apr 2025 03:06:49 +0200
Subject: [PATCH] windowswalker: walk right over errors

when an error occurs we must not process the entry because the fileinfo
points to undefined data. simply continue after logging the error.

this fixes a problem with corrupted folders that would produce entires
of themselves because the '.' and '..' skip logic didn't apply. so we
would produce (unexpected) 'foo/.' entry listings.
the locallister would then iterate into the subfolder '.' and that would
fail but yield an entry and the lister'd iterate into subfolder './.'
and that would fail ... kept going until we exhaust the path length
---
 src/windowsWalker.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/windowsWalker.cpp b/src/windowsWalker.cpp
index 7955cbb8..b2a79e7f 100644
--- a/src/windowsWalker.cpp
+++ b/src/windowsWalker.cpp
@@ -56,6 +56,8 @@ void WindowsWalker::next()
             } else {
                 qWarning() << m_path << ':' << errorCode << GetLastErrorAsString(errorCode);
             }
+            // WARNING: do not access m_fileinfo, it has undefined content!
+            continue;
         } else {
             if (m_fileinfo.cFileName == std::wstring(L".") || m_fileinfo.cFileName == std::wstring(L"..")) {
                 continue;
-- 
GitLab