Closed GoogleCodeExporter closed 9 years ago
Original comment by ger.hobbelt
on 2 Jul 2012 at 6:50
Attachments:
And for the next time, also apply this one to get better error log output,
covering the eventualities:
Original comment by ger.hobbelt
on 2 Jul 2012 at 7:07
Attachments:
Gotcha! :-) : Error was introduced in
http://code.google.com/p/mongoose/source/diff?spec=svnbe3296a79f03aa19e66b4c5c8b
1f8b16fd2222fe&r=be3296a79f03aa19e66b4c5c8b1f8b16fd2222fe&format=side&path=/mong
oose.c
Original comment by ger.hobbelt
on 2 Jul 2012 at 7:10
I believe the logic error could be fixed by changing *nread < bufsiz to
*nread <= bufsiz
This was done in
https://github.com/valenok/mongoose/commit/6c54370aa13b65a2c79f08d35fa9264e00dd7
d4d
Can you confirm that that was indeed the fix and current code does not have
that logic error please?
Original comment by valenok
on 17 Aug 2012 at 1:06
Well, looks like it when considered naively.
(flow analysis); only your way of solving this is walking the narrow edge of
the abyss as pull() will now get an input buffer length of zero and not
everybody out there is going to like that: note that UNIX man pages and OpenSSL
don't state what happens exactly when you feed recv() and friends the
senseless/illogical buflen==0 value; in fact, recv() man pages specifically
state that the recv() RETURN VALUE of ZERO is used to signal connection closed
and your feeding the bugger a buflen==0 would give *return value* zero a whole
different meaning.
Hence, expect things to break in very odd ways on various platforms; this issue
will only happen in very particular edge cases (read_request() has to hit that
buffer edge). It's up to you if you like to debug those probable failures later
on; one thing's for sure: they'll be bloody hard to reproduce, once they happen.
(provided patch was done considering such edge scenarios; meanwhile the code
has moved on, so it might be handiest if I file a pull request for this one,
now that you're on github.)
Original comment by ger.hobbelt
on 18 Aug 2012 at 12:47
pull request filed:
https://github.com/valenok/mongoose/pull/5
Original comment by ger.hobbelt
on 18 Aug 2012 at 7:49
Merged, thank you.
Original comment by valenok
on 18 Aug 2012 at 8:07
Original issue reported on code.google.com by
ger.hobbelt
on 2 Jul 2012 at 6:46