You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this error in the lacewing version of the multipart-parser-c, but I think that it also resides in your original version.
When in the s_part_data_almost_boundary condition when dealing with the test for a LF character fails, there are two current bad edge conditions, when i is 0 or when i is_last. Additionally, in the s_part_data_boundary condition when the boundary does not equal the current index, there is an edge condition when i is_last as well.
Cutting & pasting my local changes with debugging logic still in place:
multipart_parser.c(228)
/* fallthrough */
case s_part_data:
multipart_log("s_part_data");
if (c == CR) {
EMIT_DATA_CB(part_data, buf + mark, i - mark);
mark = i;
p->state = s_part_data_almost_boundary;
p->lookbehind[0] = CR;
break;
}
if (is_last)
EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1);
break;
// sckime edit begin
if (i == 0)
{
mark = i; // The new buffer mark is the start, would otherwise be -1
}
else if (is_last)
{
mark = i;
EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1); // No one will output this data otherwise.
}
else
// sckime edit end
{
mark = i --;
}
break;
case s_part_data_boundary:
multipart_log("s_part_data_boundary");
if (p->multipart_boundary[p->index] != c) {
EMIT_DATA_CB(part_data, p->lookbehind, 2 + p->index);
p->state = s_part_data;
mark = i --;
// sckime edit begin
if (is_last)
{
mark = i;
EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1); // No one will output this data otherwise.
}
//sckime edit end
break;
}
p->lookbehind[2 + p->index] = c;
if ((++ p->index) == p->boundary_length) {
NOTIFY_CB(part_data_end);
p->state = s_part_data_almost_end;
}
break;
The text was updated successfully, but these errors were encountered:
I found this error in the lacewing version of the multipart-parser-c, but I think that it also resides in your original version.
When in the s_part_data_almost_boundary condition when dealing with the test for a LF character fails, there are two current bad edge conditions, when i is 0 or when i is_last. Additionally, in the s_part_data_boundary condition when the boundary does not equal the current index, there is an edge condition when i is_last as well.
Cutting & pasting my local changes with debugging logic still in place:
multipart_parser.c(228)
/* fallthrough */
case s_part_data:
multipart_log("s_part_data");
if (c == CR) {
EMIT_DATA_CB(part_data, buf + mark, i - mark);
mark = i;
p->state = s_part_data_almost_boundary;
p->lookbehind[0] = CR;
break;
}
if (is_last)
EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1);
break;
case s_part_data_almost_boundary:
multipart_log("s_part_data_almost_boundary");
if (c == LF) {
p->state = s_part_data_boundary;
p->lookbehind[1] = LF;
p->index = 0;
break;
}
EMIT_DATA_CB(part_data, p->lookbehind, 1);
p->state = s_part_data;
case s_part_data_boundary:
multipart_log("s_part_data_boundary");
if (p->multipart_boundary[p->index] != c) {
EMIT_DATA_CB(part_data, p->lookbehind, 2 + p->index);
p->state = s_part_data;
mark = i --;
The text was updated successfully, but these errors were encountered: