mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
AK: Don't crash on invalid Base64 input
In the long-term, we should probably have a way to signal decoding failure. For now, it should suffice to at least not crash. This is particularly relevant because apparently this can be triggered while parsing a PEM certificate, which happens during every TLS connection. Found by OSS Fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=38979
This commit is contained in:
parent
20f73d2abc
commit
3bf1f7ae87
2 changed files with 9 additions and 1 deletions
|
@ -61,7 +61,7 @@ ByteBuffer decode_base64(const StringView& input)
|
|||
*is_padding = true;
|
||||
return 0;
|
||||
}
|
||||
return table[input[offset]];
|
||||
return table[static_cast<unsigned char>(input[offset])];
|
||||
};
|
||||
|
||||
Vector<u8> output;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue