1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-25 16:01:38 +03:00

Merge pull request #301 from levelup/disk-garbage

When invalid sizes are used to initialize the ArrayList
This commit is contained in:
Jesse Wilson
2013-08-29 08:29:31 -07:00

View File

@@ -284,10 +284,14 @@ final class Spdy3 implements Variant {
this.compressedLimit += length;
try {
int numberOfPairs = nameValueBlockIn.readInt();
if ((numberOfPairs * 2) < 0) {
if (numberOfPairs < 0) {
Logger.getLogger(getClass().getName()).warning("numberOfPairs < 0: " + numberOfPairs);
throw ioException("numberOfPairs < 0");
}
if (numberOfPairs > 1024) {
Logger.getLogger(getClass().getName()).warning("numberOfPairs > 1024: " + numberOfPairs);
throw ioException("numberOfPairs > 1024");
}
List<String> entries = new ArrayList<String>(numberOfPairs * 2);
for (int i = 0; i < numberOfPairs; i++) {
String name = readString();