mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
don't abort when parsing malformed UTF8 strings
Previously, we would abort the process if we encountered a truncated multibyte character in parseUtf8NonAscii (called by the JNI method NewStringUTF). Now we simply terminate the string at that point.
This commit is contained in:
parent
723dfcdf8e
commit
d3581be38e
@ -697,7 +697,6 @@ parseUtf8NonAscii(Thread* t, Stream& s, object bytesSoFar, unsigned byteCount,
|
||||
value = v;
|
||||
}
|
||||
|
||||
charArrayBody(t, value, vi) = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -4024,8 +4023,8 @@ parseUtf8(Thread* t, const char* data, unsigned length)
|
||||
public:
|
||||
Client(Thread* t): t(t) { }
|
||||
|
||||
virtual void NO_RETURN handleError() {
|
||||
vm::abort(t);
|
||||
virtual void handleError() {
|
||||
// vm::abort(t);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -19,7 +19,7 @@ class Stream {
|
||||
public:
|
||||
class Client {
|
||||
public:
|
||||
virtual void NO_RETURN handleError() = 0;
|
||||
virtual void handleError() = 0;
|
||||
};
|
||||
|
||||
Stream(Client* client, const uint8_t* data, unsigned size):
|
||||
@ -44,11 +44,7 @@ class Stream {
|
||||
|
||||
void read(uint8_t* data, unsigned size) {
|
||||
if (size > this->size - position_) {
|
||||
// GCC 4.4 will give us an uninitialized value warning in read1
|
||||
// unless we do this: (it's smart enough to track data flow
|
||||
// across functions but not smart enough to see we won't return
|
||||
// from Client::handleError)
|
||||
*data = 0;
|
||||
memset(data, 0, size);
|
||||
|
||||
client->handleError();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user