Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix: Trailing boundary-like data caused parse error

When we discard a started boundary at the end of a part's data block,
we need to re-consider the current character as it could be the
beginning of a new boundary sequence itself.
  • Loading branch information...
commit a83a6a8c5a8ef96821d1e44e0ebed3d047bc37da 1 parent 83d903d
Hongli Lai authored
Showing with 8 additions and 0 deletions.
  1. +4 −0 input.txt
  2. +4 −0 multipart.cpp
4 input.txt
View
@@ -1,6 +1,10 @@
--abcd
content-type: text/plain
foo-bar: abc
+x: y
hello world
+
+x
+
--abcd--
4 multipart.cpp
View
@@ -349,6 +349,10 @@ class MultipartParser {
callback(onPartData, lookbehind, 0, prevIndex);
prevIndex = 0;
partDataMark = i;
+
+ // reconsider the current character even so it interrupted the sequence
+ // it could be the beginning of a new sequence
+ i--;
}
break;
Please sign in to comment.
Something went wrong with that request. Please try again.