aboutsummaryrefslogtreecommitdiff
path: root/js/compatibility_tests/v3.0.0/binary/decoder_test.js
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2017-09-13 14:23:59 -0700
committerGitHub <noreply@github.com>2017-09-13 14:23:59 -0700
commit8741da3e45876f8c55ca062a08726f542f646423 (patch)
tree817ec4f768f008b6016d4b787f378bbb09eff814 /js/compatibility_tests/v3.0.0/binary/decoder_test.js
parent2bd55a9fbcd2815b3332bf309bc20f59eef0b36b (diff)
downloadprotobuf-8741da3e45876f8c55ca062a08726f542f646423.tar.gz
protobuf-8741da3e45876f8c55ca062a08726f542f646423.tar.bz2
protobuf-8741da3e45876f8c55ca062a08726f542f646423.zip
Revert "Fix js conformance tests. (#3604)" (#3633)
This reverts commit 2bd55a9fbcd2815b3332bf309bc20f59eef0b36b.
Diffstat (limited to 'js/compatibility_tests/v3.0.0/binary/decoder_test.js')
-rw-r--r--js/compatibility_tests/v3.0.0/binary/decoder_test.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/js/compatibility_tests/v3.0.0/binary/decoder_test.js b/js/compatibility_tests/v3.0.0/binary/decoder_test.js
index fce2fe18..ac312648 100644
--- a/js/compatibility_tests/v3.0.0/binary/decoder_test.js
+++ b/js/compatibility_tests/v3.0.0/binary/decoder_test.js
@@ -228,7 +228,24 @@ describe('binaryDecoderTest', function() {
assertThrows(function() {decoder.readSignedVarint64()});
decoder.reset();
assertThrows(function() {decoder.readZigzagVarint64()});
- decoder.reset();
+
+ // Positive 32-bit varints encoded with 1 bits in positions 33 through 35
+ // should trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 0x1F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x2F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 0x4F]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ // Negative 32-bit varints encoded with non-1 bits in the high dword should
+ // trigger assertions.
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 0, 255, 255, 1]);
+ assertThrows(function() {decoder.readUnsignedVarint32()});
+
+ decoder.setBlock([255, 255, 255, 255, 255, 255, 255, 255, 255, 0]);
assertThrows(function() {decoder.readUnsignedVarint32()});
});