Bug: chromium:1322914 Change-Id: Ic5a1349013bcfb279e5fee9f9838c63558d663b7 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63025 Auto-Submit: Bob Beck <bbe@google.com> Commit-Queue: Bob Beck <bbe@google.com> Reviewed-by: David Benjamin <davidben@google.com>chromium-stable
parent
15b1f9c6a4
commit
3aecf1d00b
12 changed files with 81 additions and 147 deletions
@ -0,0 +1,24 @@ |
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <stddef.h> |
||||
#include <stdint.h> |
||||
|
||||
#include "../pki/parse_certificate.h" |
||||
#include "../pki/input.h" |
||||
#include <openssl/base.h> |
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
||||
std::vector<bssl::ParsedDistributionPoint> distribution_points; |
||||
|
||||
bool success = ParseCrlDistributionPoints(bssl::der::Input(data, size), |
||||
&distribution_points); |
||||
|
||||
if (success) { |
||||
// A valid CRLDistributionPoints must have at least 1 element.
|
||||
BSSL_CHECK(!distribution_points.empty()); |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -1,16 +0,0 @@ |
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef PKI_FILLINS_INET_H_ |
||||
#define PKI_FILLINS_INET_H_ |
||||
|
||||
#include <openssl/base.h> |
||||
|
||||
#if defined(OPENSSL_WINDOWS) |
||||
#include <winsock2.h> |
||||
#else |
||||
#include <arpa/inet.h> |
||||
#endif // OPENSSL_WINDOWS
|
||||
|
||||
#endif // PKI_FILLINS_INET_H_
|
@ -1,47 +0,0 @@ |
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "utf_string_conversions.h" |
||||
|
||||
namespace bssl { |
||||
|
||||
namespace fillins { |
||||
|
||||
static const size_t kMaxUTF8Bytes = 4; |
||||
|
||||
static size_t EncodeUTF8(uint32_t codepoint, char *out_buf) { |
||||
if (codepoint < 0x7f) { |
||||
out_buf[0] = codepoint; |
||||
return 1; |
||||
} |
||||
|
||||
if (codepoint <= 0x7ff) { |
||||
out_buf[0] = 0xc0 | (codepoint >> 6); |
||||
out_buf[1] = 0x80 | (codepoint & 0x3f); |
||||
return 2; |
||||
} |
||||
|
||||
if (codepoint <= 0xffff) { |
||||
out_buf[0] = 0xe0 | (codepoint >> 12); |
||||
out_buf[1] = 0x80 | ((codepoint >> 6) & 0x3f); |
||||
out_buf[2] = 0x80 | (codepoint & 0x3f); |
||||
return 3; |
||||
} |
||||
|
||||
out_buf[0] = 0xf0 | (codepoint >> 18); |
||||
out_buf[1] = 0x80 | ((codepoint >> 12) & 0x3f); |
||||
out_buf[2] = 0x80 | ((codepoint >> 6) & 0x3f); |
||||
out_buf[3] = 0x80 | (codepoint & 0x3f); |
||||
return 4; |
||||
} |
||||
|
||||
void WriteUnicodeCharacter(uint32_t codepoint, std::string *append_to) { |
||||
char buf[kMaxUTF8Bytes]; |
||||
const size_t num_bytes = EncodeUTF8(codepoint, buf); |
||||
append_to->append(buf, num_bytes); |
||||
} |
||||
|
||||
} // namespace fillins
|
||||
|
||||
} // namespace bssl
|
@ -1,34 +0,0 @@ |
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BSSL_FILLINS_UTF_STRING_CONVERSIONS |
||||
#define BSSL_FILLINS_UTF_STRING_CONVERSIONS |
||||
|
||||
#include <openssl/base.h> |
||||
|
||||
#include <string> |
||||
|
||||
#define CBU_IS_SURROGATE(c) (((c)&0xfffff800) == 0xd800) |
||||
|
||||
#define CBU_IS_UNICODE_NONCHAR(c) \ |
||||
((c) >= 0xfdd0 && ((uint32_t)(c) <= 0xfdef || ((c)&0xfffe) == 0xfffe) && \
|
||||
(uint32_t)(c) <= 0x10ffff) |
||||
|
||||
#define CBU_IS_UNICODE_CHAR(c) \ |
||||
((uint32_t)(c) < 0xd800 || \
|
||||
((uint32_t)(c) > 0xdfff && (uint32_t)(c) <= 0x10ffff && \
|
||||
!CBU_IS_UNICODE_NONCHAR(c))) |
||||
|
||||
namespace bssl { |
||||
|
||||
namespace fillins { |
||||
|
||||
OPENSSL_EXPORT void WriteUnicodeCharacter(uint32_t codepoint, |
||||
std::string *append_to); |
||||
|
||||
} // namespace fillins
|
||||
|
||||
} // namespace bssl
|
||||
|
||||
#endif // BSSL_FILLINS_UTF_STRING_CONVERSIONS
|
Loading…
Reference in new issue