From 057a12eb71d4056efc1c0a3f0e75b51d0790e11d Mon Sep 17 00:00:00 2001 From: Ishmaeel Date: Sat, 31 Jul 2021 07:54:00 +0300 Subject: [PATCH] Disregard "Auto Newline" user setting and always assume auto newline in FileReader This may not be the proper place to fix this but it works nicely at least as a temporary measure. The alternative is a potential DoS when trying to open large files as discussed in #352. Now FileReader always splits on newlines regardless of what the user selected for "Auto Newline" option from the menu. Fixes #352. --- DebugView++Lib/FileReader.cpp | 5 +++++ include/DebugView++Lib/FileReader.h | 1 + 2 files changed, 6 insertions(+) diff --git a/DebugView++Lib/FileReader.cpp b/DebugView++Lib/FileReader.cpp index a7f18419..542b994b 100644 --- a/DebugView++Lib/FileReader.cpp +++ b/DebugView++Lib/FileReader.cpp @@ -46,6 +46,11 @@ void FileReader::Abort() } } +bool FileReader::GetAutoNewLine() const +{ + return true; +} + void FileReader::PollThread() { // FILE_NOTIFY_CHANGE_SIZE is broken on windows vista and above in that it does not diff --git a/include/DebugView++Lib/FileReader.h b/include/DebugView++Lib/FileReader.h index c6d0ddbd..a1531ec3 100644 --- a/include/DebugView++Lib/FileReader.h +++ b/include/DebugView++Lib/FileReader.h @@ -32,6 +32,7 @@ class FileReader : public LogSource HANDLE GetHandle() const override; void Notify() override; void PreProcess(Line& line) const override; + virtual bool GetAutoNewLine() const override; protected: virtual void AddLine(const std::string& line);