Bug 1000354: Fix comment and make test clearer (r=keeler)
authorMonica Chew <mmc@mozilla.com>
Wed, 07 May 2014 15:48:23 -0700
changeset 182067 52f249e906ce34349523c2331c43150224d4db50
parent 182066 2175e6154ed77c365c93a6327242572703355301
child 182068 3b5fb4abaa3fe006cbcc34fa0bfcb940b1101c53
push id26745
push usercbook@mozilla.com
push dateThu, 08 May 2014 11:47:46 +0000
treeherdermozilla-central@2915a02d24cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskeeler
bugs1000354
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1000354: Fix comment and make test clearer (r=keeler)
security/pkix/test/gtest/pkixder_input_tests.cpp
--- a/security/pkix/test/gtest/pkixder_input_tests.cpp
+++ b/security/pkix/test/gtest/pkixder_input_tests.cpp
@@ -85,18 +85,22 @@ TEST_F(pkixder_input_tests, InputInitWit
 {
   Input input;
   ASSERT_EQ(Failure, input.Init(nullptr, 0));
   ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError());
 
   ASSERT_EQ(Failure, input.Init(nullptr, 100));
   ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError());
 
-  // Is this a bug?
+  // Though it seems odd to initialize with zero-length and non-null ptr, this
+  // is working as intended. The Input class was intended to protect against
+  // buffer overflows, and there's no risk with the current behavior. See bug
+  // 1000354.
   ASSERT_EQ(Success, input.Init((const uint8_t*) "hello", 0));
+  ASSERT_TRUE(input.AtEnd());
 }
 
 TEST_F(pkixder_input_tests, InputInitWithLargeData)
 {
   Input input;
   // Data argument length does not matter, it is not touched, just
   // needs to be non-null
   ASSERT_EQ(Failure, input.Init((const uint8_t*) "", 0xffff+1));