Bug 1147919 - Part 2: Lowercase fingerprint alg before comparing. r=drno, a=sledru
authorByron Campen [:bwc] <docfaraday@gmail.com>
Mon, 06 Apr 2015 11:07:53 -0700
changeset 258287 a606f164b2a7
parent 258286 38cb0f4d54e8
child 258288 05f716c8608d
push id4636
push userbcampen@mozilla.com
push date2015-04-06 18:31 +0000
treeherdermozilla-beta@a606f164b2a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno, sledru
bugs1147919
milestone38.0
Bug 1147919 - Part 2: Lowercase fingerprint alg before comparing. r=drno, a=sledru
media/webrtc/signaling/src/sdp/SdpAttribute.h
--- a/media/webrtc/signaling/src/sdp/SdpAttribute.h
+++ b/media/webrtc/signaling/src/sdp/SdpAttribute.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _SDPATTRIBUTE_H_
 #define _SDPATTRIBUTE_H_
 
 #include <algorithm>
+#include <cctype>
 #include <vector>
 #include <ostream>
 #include <sstream>
 #include <cstring>
 #include <iomanip>
 #include <string>
 
 #include "mozilla/UniquePtr.h"
@@ -302,20 +303,25 @@ public:
   struct Fingerprint {
     HashAlgorithm hashFunc;
     std::vector<uint8_t> fingerprint;
   };
 
   // For use by application programmers. Enforces that it's a known and
   // non-crazy algorithm.
   void
-  PushEntry(const std::string& algorithm_str,
+  PushEntry(std::string algorithm_str,
             const std::vector<uint8_t>& fingerprint,
             bool enforcePlausible = true)
   {
+    std::transform(algorithm_str.begin(),
+                   algorithm_str.end(),
+                   algorithm_str.begin(),
+                   ::tolower);
+
     SdpFingerprintAttributeList::HashAlgorithm algorithm =
         SdpFingerprintAttributeList::kUnknownAlgorithm;
 
     if (algorithm_str == "sha-1") {
       algorithm = SdpFingerprintAttributeList::kSha1;
     } else if (algorithm_str == "sha-224") {
       algorithm = SdpFingerprintAttributeList::kSha224;
     } else if (algorithm_str == "sha-256") {