Permalink
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...
1 parent 83d903d commit a83a6a8c5a8ef96821d1e44e0ebed3d047bc37da @FooBarWidget committed Jun 22, 2010
Showing with 8 additions and 0 deletions.
  1. +4 −0 input.txt
  2. +4 −0 multipart.cpp
View
4 input.txt
@@ -1,6 +1,10 @@
--abcd
content-type: text/plain
foo-bar: abc
+x: y
hello world
+
+x
+
--abcd--
View
4 multipart.cpp
@@ -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;

0 comments on commit a83a6a8

Please sign in to comment.