A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/097fdb86ff7017c425ff90ee55caf97027888f40 below:

Improve error messaging when detecting and erroring out on integer ov… · protocolbuffers/protobuf@097fdb8 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+7

-4

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+7

-4

lines changed Original file line number Diff line number Diff line change

@@ -1184,7 +1184,8 @@ public int pushLimit(int byteLimit) throws InvalidProtocolBufferException {

1184 1184

}

1185 1185

byteLimit += getTotalBytesRead();

1186 1186

if (byteLimit < 0) {

1187 -

throw InvalidProtocolBufferException.parseFailure();

1187 +

// Check for for integer overflow in byteLimit

1188 +

throw InvalidProtocolBufferException.sizeLimitExceeded();

1188 1189

}

1189 1190

final int oldLimit = currentLimit;

1190 1191

if (byteLimit > oldLimit) {

@@ -2679,7 +2680,8 @@ public int pushLimit(int byteLimit) throws InvalidProtocolBufferException {

2679 2680

}

2680 2681

byteLimit += totalBytesRetired + pos;

2681 2682

if (byteLimit < 0) {

2682 -

throw InvalidProtocolBufferException.parseFailure();

2683 +

// Check for for integer overflow in byteLimit

2684 +

throw InvalidProtocolBufferException.sizeLimitExceeded();

2683 2685

}

2684 2686

final int oldLimit = currentLimit;

2685 2687

if (byteLimit > oldLimit) {

Original file line number Diff line number Diff line change

@@ -137,8 +137,9 @@ static InvalidProtocolBufferException recursionLimitExceeded() {

137 137 138 138

static InvalidProtocolBufferException sizeLimitExceeded() {

139 139

return new InvalidProtocolBufferException(

140 -

"Protocol message was too large. May be malicious. "

141 -

+ "Use CodedInputStream.setSizeLimit() to increase the size limit.");

140 +

"Protocol message was too large. May be malicious. Use CodedInputStream.setSizeLimit() to"

141 +

+ " increase the size limit. If reading multiple messages, consider resetting the"

142 +

+ " counter between each message using CodedInputStream.resetSizeCounter().");

142 143

}

143 144 144 145

static InvalidProtocolBufferException parseFailure() {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4