Bug 1147919 - Part 2: Lowercase fingerprint alg before comparing. r=drno
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 27 Mar 2015 13:26:16 -0700
changeset 266650 aca75f4ef930df34569d6d79b377a8d3186a5c24
parent 266649 54e20c1910611f9c3706e3125ff4eaa6417fe4e1
child 266651 bf414f68291cd6a77b35de593ab589915db56b48
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1147919
milestone39.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 1147919 - Part 2: Lowercase fingerprint alg before comparing. r=drno
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") {