-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Net: stack-buffer-overflow if HTTP request contains a header with invalid UTF32 sequence #4690
Comments
The reason is that for line 115 there is no check that poco/Foundation/src/TextIterator.cpp Lines 111 to 115 in cefab15
|
That damn |
I tried in VisualStudio 2022 |
@micheleselea Did you compile with address sanitizer enabled? |
I did the test in debug environment so I suppose it's enabled by default, but I double check it |
No, it's not, you need to enable it explicitly |
I also cannot reproduce this on macOS with ASAN enabled. I've also added assertions to catch the buffer overflow. Maybe this was fixed with #4320? |
Anyway, I have added an assertion to guard against buffer overflows caused by buggy TextEncoding implementations. |
I tested with the assert you put in the code and in my version of poco I don't have the problem. I tested with the crash-7e3fdbcc15ad941711a3a1d2502ac293a272c267.txt proposed and with testUTF32Invalid1 and testUTF32Invalid2 |
@obiltschnig You are right, after #4320 the issue is not reproduced (and reproduced before that patch). I used the "devel" branch which seems a little bit outdated. Thanks, we can close this issue now. |
Describe the bug
During a fuzzing test, ASAN reported a stack-buffer-overflow error in
TextIterator::operator * ()
. It happened due to a missing check for a buffer size.To Reproduce
Poco::MemoryInputStream stream(input.data(), input.size()); Poco::Net::HTTPRequest request; request.read(stream);
with the following input: crash-7e3fdbcc15ad941711a3a1d2502ac293a272c267.txt
Expected behavior
ASAN doesn't report any errors.
Logs
I prepared two unit tests that are failing now for simplification:
The text was updated successfully, but these errors were encountered: