mozilla-bmo1573381.patch
branchfirefox68
changeset 1101 a4709640638e
equal deleted inserted replaced
1100:e1c5065a014f 1101:a4709640638e
       
     1 # HG changeset patch
       
     2 # Parent  45680ce4ca06795cbca1ea5a9ae8a7a11ab95cf1
       
     3 The code tries to find a codec in a list of codecs. For this it searches for a given prefix.
       
     4 But the prefix is of type char16_t, which means 2 bytes per character instead of 1, as was compared here.
       
     5 On big endian this created some false positives, as the order of bytes is different and some characters only
       
     6 occupy "the first" byte, having the second null'ed out.
       
     7 Noticed because of gtest: MediaMIMETypes.MediaCodecs
       
     8 
       
     9 Upstream bugreport: https://bugzilla.mozilla.org/show_bug.cgi?id=1573381
       
    10 
       
    11 diff -r 45680ce4ca06 -r 381102061fcc dom/media/MediaMIMETypes.cpp
       
    12 --- a/dom/media/MediaMIMETypes.cpp	Mon Aug 05 09:28:53 2019 +0200
       
    13 +++ b/dom/media/MediaMIMETypes.cpp	Tue Aug 13 07:51:27 2019 +0200
       
    14 @@ -87,7 +87,7 @@
       
    15    const size_t prefixLength = aCodecPrefix.Length();
       
    16    for (const auto& myCodec : Range()) {
       
    17      if (myCodec.Length() >= prefixLength &&
       
    18 -        memcmp(myCodec.Data(), aCodecPrefix.Data(), prefixLength) == 0) {
       
    19 +        memcmp(myCodec.Data(), aCodecPrefix.Data(), prefixLength * sizeof(char16_t)) == 0) {
       
    20        return true;
       
    21      }
       
    22    }