From 27ef7f2e21e8f60c550012826febdffca476d68b Mon Sep 17 00:00:00 2001 From: ado Date: Mon, 31 Jul 2023 21:49:01 +0200 Subject: [PATCH] Fix bug where the parsing of data containing escaped new lines within quotes would produce bad outputs --- include/ss/parser.hpp | 5 ++--- ssp.hpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/ss/parser.hpp b/include/ss/parser.hpp index 4ad4df4..d9dfb21 100644 --- a/include/ss/parser.hpp +++ b/include/ss/parser.hpp @@ -600,6 +600,8 @@ private: if constexpr (quoted_multiline_enabled) { while (unterminated_quote()) { + size -= next_line_converter_.size_shifted(); + if (multiline_limit_reached(limit)) { return true; } @@ -665,9 +667,6 @@ private: } void undo_remove_eol(char* buffer, size_t& string_end) { - if (next_line_converter_.unterminated_quote()) { - string_end -= next_line_converter_.size_shifted(); - } if (crlf_) { std::copy_n("\r\n\0", 3, buffer + string_end); string_end += 2; diff --git a/ssp.hpp b/ssp.hpp index 453da87..13b5a44 100644 --- a/ssp.hpp +++ b/ssp.hpp @@ -2792,6 +2792,8 @@ private: if constexpr (quoted_multiline_enabled) { while (unterminated_quote()) { + size -= next_line_converter_.size_shifted(); + if (multiline_limit_reached(limit)) { return true; } @@ -2857,9 +2859,6 @@ private: } void undo_remove_eol(char* buffer, size_t& string_end) { - if (next_line_converter_.unterminated_quote()) { - string_end -= next_line_converter_.size_shifted(); - } if (crlf_) { std::copy_n("\r\n\0", 3, buffer + string_end); string_end += 2;