Bug 1125592 - Fix -Wmaybe-uninitialized warning in security/manager/ssl/src/nsNSSASN1Object.cpp. r=dkeeler
authorChris Peterson <cpeterson@mozilla.com>
Fri, 23 Jan 2015 22:58:43 -0800
changeset 225923 2b207b997e4cb0ec06339ac96a74d654b4a19bcf
parent 225922 cffc8f5b70681e412f5e26191b7ef84c3909e422
child 225924 8eec3d8ec60a928e55d90bb94a9430a36fc7e64f
push id28179
push usercbook@mozilla.com
push dateTue, 27 Jan 2015 14:24:11 +0000
treeherdermozilla-central@232401a6d1cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdkeeler
bugs1125592
milestone38.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 1125592 - Fix -Wmaybe-uninitialized warning in security/manager/ssl/src/nsNSSASN1Object.cpp. r=dkeeler
security/manager/ssl/src/nsNSSASN1Object.cpp
--- a/security/manager/ssl/src/nsNSSASN1Object.cpp
+++ b/security/manager/ssl/src/nsNSSASN1Object.cpp
@@ -121,21 +121,27 @@ buildASN1ObjectFromDER(unsigned char *da
     tagnum = code & SEC_ASN1_TAGNUM_MASK;
 
     /*
      * NOTE: This code does not (yet) handle the high-tag-number form!
      */
     if (tagnum == SEC_ASN1_HIGH_TAG_NUMBER) {
       return NS_ERROR_FAILURE;
     }
+
     data++;
     len = getDERItemLength(data, end, &bytesUsed, &indefinite);
+    if (len < 0) {
+      return NS_ERROR_FAILURE;
+    }
+
     data += bytesUsed;
-    if ((len < 0) || ((data+len) > end))
+    if (data + len > end) {
       return NS_ERROR_FAILURE;
+    }
 
     if (code & SEC_ASN1_CONSTRUCTED) {
       if (len > 0 || indefinite) {
         sequence = new nsNSSASN1Sequence();
         switch (code & SEC_ASN1_CLASS_MASK) {
         case SEC_ASN1_UNIVERSAL:
           type = tagnum;
           break;
@@ -313,17 +319,16 @@ nsNSSASN1Sequence::GetIsExpanded(bool *a
 
 NS_IMETHODIMP 
 nsNSSASN1Sequence::SetIsExpanded(bool aIsExpanded)
 {
   mIsExpanded = aIsExpanded;
   return NS_OK;
 }
 
-
 nsNSSASN1PrintableItem::nsNSSASN1PrintableItem() : mType(0),
                                                    mTag(0),
                                                    mData(nullptr),
                                                    mLen(0)
 {
   /* member initializers and constructor code */
 }
 
@@ -420,9 +425,8 @@ nsNSSASN1PrintableItem::GetDisplayName(n
 }
 
 NS_IMETHODIMP 
 nsNSSASN1PrintableItem::SetDisplayName(const nsAString &aDisplayName)
 {
   mDisplayName = aDisplayName;
   return NS_OK;
 }
-