ladybird/AK
Ben Wiederhake ff8f3814cc AK+Tests: Avoid creating invalid code points from malformed UTF-8
Instead of doing anything reasonable, Utf8CodePointIterator returned
invalid code points, for example U+123456. However, many callers of this
iterator assume that a code point is always at most 0x10FFFF.

In fact, this is one of two reasons for the following OSS Fuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49184
This is probably a very old bug.

In the particular case of URLParser, AK::is_url_code_point got confused:
    return /* ... */ || code_point >= 0xA0;
If code_point is a "code point" beyond 0x10FFFF, this violates the
condition given in the preceding comment, but satisfies the given
condition, which eventually causes URLParser to crash.

This commit fixes *only* the erroneous UTF-8 decoding, and does not
fully resolve OSS-Fuzz#49184.
2022-10-09 10:37:20 -06:00
..
.clang-tidy
AllOf.h AK: Add nodiscard attribute to AllOf functions 2022-07-04 05:53:56 +00:00
AnyOf.h AK: Add nodiscard attribute to AnyOf functions 2022-07-04 05:53:56 +00:00
ArbitrarySizedEnum.h
Array.h
Assertions.cpp AK: Print VERIFY() error messages in release builds 2022-10-06 15:29:38 +02:00
Assertions.h AK: Print VERIFY() error messages in release builds 2022-10-06 15:29:38 +02:00
Atomic.h
AtomicRefCounted.h AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernel 2022-08-20 17:15:52 +02:00
Badge.h
Base64.cpp
Base64.h AK: Add nodiscard attribute to Base64 functions 2022-07-04 05:53:56 +00:00
BinaryBufferWriter.h
BinaryHeap.h AK: Add nodiscard attribute to BinaryHeap functions 2022-07-04 05:53:56 +00:00
BinarySearch.h AK: Add nodiscard attribute to BinarySearch functions 2022-07-04 05:53:56 +00:00
BitCast.h AK: Allow bit_cast to be used in constant evaluated context 2022-08-15 17:11:25 +02:00
Bitmap.h
BitmapView.h
BitStream.h AK: Add nodiscard attribute to BitStream functions 2022-07-04 05:53:56 +00:00
Buffered.h
BuiltinWrappers.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
BumpAllocator.h AK+LibGfx+LibJS: Pass -1 as the file descriptor to anonymous mmap 2022-07-19 12:39:24 +02:00
ByteBuffer.h AK: Add Traits<ByteBuffer>::hash() 2022-07-14 00:42:26 +01:00
ByteReader.h
CharacterTypes.h
Checked.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
CheckedFormatString.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
CircularDeque.h
CircularDuplexStream.h
CircularQueue.h
CMakeLists.txt
Complex.h
Concepts.h
DateConstants.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
DateTimeLexer.h
Debug.h.in AK+Meta: Define a debug flag for LibTimeZone 2022-09-28 23:52:51 +01:00
Demangle.h Everywhere: Explicitly specify the size in StringView constructors 2022-07-12 23:11:35 +02:00
DisjointChunks.h
DistinctNumeric.h Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_' 2022-07-22 23:09:43 +01:00
DoublyLinkedList.h
Endian.h
EnumBits.h
Error.h AK: Change ErrorOr to contain a Variant rather than inherit from it 2022-10-07 18:21:40 +01:00
ExtraMathConstants.h
FileStream.h
Find.h AK: Add nodiscard attribute to Find functions 2022-07-04 05:53:56 +00:00
FixedArray.h AK: Make empty FixedArray smaller 2022-08-27 12:19:37 +02:00
FixedPoint.h
FloatingPoint.h AK: Add FloatingPoint.h 2022-08-27 12:28:05 +02:00
FlyString.cpp
FlyString.h
Format.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
Format.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
Forward.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
FPControl.h
Function.h
FuzzyMatch.cpp AK: Do not require an allocated String for fuzzy matching 2022-09-20 11:08:54 +01:00
FuzzyMatch.h AK: Do not require an allocated String for fuzzy matching 2022-09-20 11:08:54 +01:00
GenericLexer.cpp
GenericLexer.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
GenericShorthands.h AK: Add header for generic shorthands 2022-07-04 11:15:40 +02:00
HashFunctions.h
HashMap.h
HashTable.h AK: Zero previous pointer *after* fixing the insertion list in HashTable 2022-06-23 20:25:12 +03:00
Hex.cpp
Hex.h
IDAllocator.h
IntegralMath.h AK: Add AK::ceil(float) and AK::ceil_log2(integer) 2022-06-30 11:16:22 +02:00
IntrusiveDetails.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
IntrusiveList.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
IntrusiveListRelaxedConst.h
IntrusiveRedBlackTree.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
IPv4Address.h AK: Add IPv4Address::netmask_from_cidr 2022-07-09 09:22:25 +01:00
IPv6Address.h
IterationDecision.h
Iterator.h
JsonArray.h
JsonArraySerializer.h
JsonObject.h Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
JsonObjectSerializer.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
JsonParser.cpp AK: Allow exponents in JSON double values 2022-09-02 02:07:37 +01:00
JsonParser.h
JsonPath.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
JsonPath.h
JsonValue.cpp AK: Treat empty string as invalid JSON 2022-07-10 23:31:48 +02:00
JsonValue.h
kmalloc.cpp
kmalloc.h
kstdio.h
LEB128.h AK: Always check shift amount in LEB128 read functions 2022-07-09 22:04:31 +00:00
LexicalPath.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
LexicalPath.h
MACAddress.h Everywhere: Replace single-char StringView op. arguments with chars 2022-07-12 23:11:35 +02:00
Math.h AK: Add AK::ceil(float) and AK::ceil_log2(integer) 2022-06-30 11:16:22 +02:00
MemMem.h AK: Use the correct data types in bitap_bitwise() 2022-07-14 13:10:23 +02:00
Memory.h
MemoryStream.h
NeverDestroyed.h
NoAllocationGuard.h
Noncopyable.h
NonnullOwnPtr.h
NonnullOwnPtrVector.h
NonnullPtrVector.h AK: Allow creating NonnullPtrVectors from an initializer list 2022-09-08 18:53:08 +02:00
NonnullRefPtr.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
NonnullRefPtrVector.h
NumberFormat.h AK: Add human_readable_digital_time() helper 2022-08-05 13:55:13 +02:00
NumericLimits.h
Optional.h
OwnPtr.h
Platform.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
PrintfImplementation.h AK: Fix a comment typo 2022-09-30 20:09:26 -07:00
Ptr32.h
Queue.h
QuickSort.h
Random.cpp
Random.h Lagom: Win32 support baby steps 2022-09-29 17:01:22 +01:00
RecursionDecision.h
RedBlackTree.h
RefCounted.h AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernel 2022-08-20 17:15:52 +02:00
RefCountForwarder.h
RefPtr.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
Result.h
ReverseIterator.h
ScopedValueRollback.h
ScopeGuard.h
ScopeLogger.h
SIMD.h
SIMDExtras.h LibGfx: Implement PNG filtering on write 2022-07-10 15:01:07 +02:00
SIMDMath.h
Singleton.h Lagom: Win32 support baby steps 2022-09-29 17:01:22 +01:00
SinglyLinkedList.h
SinglyLinkedListWithCount.h
SourceGenerator.h AK: Warn when trying to set @foo@ as a SourceGenerator key 2022-09-09 15:18:07 +02:00
SourceLocation.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
Span.h
Stack.h
StackInfo.cpp AK: Port StackInfo to FreeBSD 2022-07-19 12:39:24 +02:00
StackInfo.h
Statistics.h
StdLibExtraDetails.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
StdLibExtras.h AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places 2022-10-04 23:35:07 +01:00
Stream.h Everywhere: Split Error::from_string_literal and Error::from_string_view 2022-07-12 23:11:35 +02:00
String.cpp AK: Remove String <-> char const* comparison operators 2022-07-12 23:11:35 +02:00
String.h AK: Add a helper to get the last split-group 2022-07-15 12:42:43 +02:00
StringBuilder.cpp StringBuilder: Add try_append_repeated() and append_repeated() 2022-09-15 14:08:21 +01:00
StringBuilder.h StringBuilder: Add try_append_repeated() and append_repeated() 2022-09-15 14:08:21 +01:00
StringHash.h
StringImpl.cpp
StringImpl.h
StringUtils.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
StringUtils.h AK: Use an enum instead of a bool for String::replace(all_occurences) 2022-07-06 11:12:45 +02:00
StringView.cpp AK+Everywhere: Fix data corruption due to code-point-to-char conversion 2022-10-09 10:37:20 -06:00
StringView.h AK+Everywhere: Fix data corruption due to code-point-to-char conversion 2022-10-09 10:37:20 -06:00
TemporaryChange.h
Time.cpp Lagom: Win32 support baby steps 2022-09-29 17:01:22 +01:00
Time.h Lagom: Win32 support baby steps 2022-09-29 17:01:22 +01:00
Traits.h
Trie.h
Try.h
Tuple.h
TypeCasts.h
TypedTransfer.h
TypeList.h
Types.h Lagom: Win32 support baby steps 2022-09-29 17:01:22 +01:00
UBSanitizer.h
UFixedBigInt.h
UnicodeUtils.h
URL.cpp AK+Everywhere: Fix data corruption due to code-point-to-char conversion 2022-10-09 10:37:20 -06:00
URL.h AK+Everywhere: Replace "protocol" with "scheme" url helpers 2022-09-29 09:39:04 +01:00
URLParser.cpp AK+Everywhere: Fix data corruption due to code-point-to-char conversion 2022-10-09 10:37:20 -06:00
URLParser.h
Userspace.h
Utf8View.cpp AK+Tests: Avoid creating invalid code points from malformed UTF-8 2022-10-09 10:37:20 -06:00
Utf8View.h
Utf16View.cpp
Utf16View.h
Utf32View.h
UUID.cpp
UUID.h
Variant.h
Vector.h
Weakable.h AK: Make Weakable non-atomic 2022-09-03 00:36:25 +02:00
WeakPtr.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00