serenity/AK
Lucas CHOLLET 3b824ec8c9 AK+Test: Fix a logic error in CircularBuffer::offset_of()
This error was introduced by 9a7accdd and had a significant impact on
`BufferedFile` behavior. Hence, we started seeing crash in test262.

By itself, the issue was a wrong calculation of the internal reading
spans when using the `read` and `until` parameters. Which can lead to
at worse crash in VERIFY and at least weird behaviors as missed needles
or detections out of bounds.

It was also accompanied by an erroneous test.

This patch fixes the bug, the test and also provides more tests.
2023-01-15 23:23:24 +00:00
..
.clang-tidy Meta: Add basic clang-tidy configuration 2021-11-14 22:52:35 +01:00
AllOf.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
AnyOf.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
ArbitrarySizedEnum.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Array.h AK: Add Span to Array conversion function 2022-12-15 00:21:00 -07:00
Assertions.cpp AK: Print VERIFY() error messages in release builds 2022-10-06 15:29:38 +02:00
Assertions.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Atomic.h Everywhere: Stop shoving things into ::std and mentioning them as such 2022-12-14 11:44:32 +01:00
AtomicRefCounted.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
Badge.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Base64.cpp AK+LibWeb: Move decode forgiving base64 under Web::Infra namespace 2023-01-10 17:54:01 +00:00
Base64.h AK+LibWeb: Move decode forgiving base64 under Web::Infra namespace 2023-01-10 17:54:01 +00:00
BinaryBufferWriter.h Everywhere: Remove unnecessary AK and Detail namespace scoping 2022-12-09 11:25:30 +00:00
BinaryHeap.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
BinarySearch.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
BitCast.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Bitmap.h AK+Everywhere: Replace all Bitmap::must_create() uses with ::create() 2022-12-22 15:48:53 +01:00
BitmapView.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
BitStream.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Buffered.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
BuiltinWrappers.h AK: Fix build with !USING_AK_GLOBALLY 2022-12-13 08:09:56 +03:30
BumpAllocator.h AK: Take the bump-allocated chunk header into account in destroy_all() 2022-12-06 11:19:50 +01:00
ByteBuffer.h AK: Prefer VERIFY_NOT_REACHED in ByteBuffer 2022-12-31 23:20:37 +01:00
ByteReader.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
CharacterTypes.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Checked.h AK: Use __has_builtin() in Checked.h 2022-12-19 09:29:12 -05:00
CheckedFormatString.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
CircularBuffer.cpp AK+Test: Fix a logic error in CircularBuffer::offset_of() 2023-01-15 23:23:24 +00:00
CircularBuffer.h AK: Add an optional starting offset to CircularBuffer::offset_of 2023-01-14 16:20:30 -07:00
CircularDeque.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
CircularQueue.h AK: Remove CircularDuplexStream 2023-01-14 12:05:52 -05:00
CMakeLists.txt AK: Implement FlyString for the new String class 2023-01-12 11:23:58 +01:00
Complex.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Concepts.h AK: Introduce the DerivedFrom concept 2022-12-12 16:21:39 +00:00
DateConstants.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
DateTimeLexer.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Debug.h.in LibVideo: Add PlaybackManager to load and decode videos 2022-10-31 14:47:13 +01:00
DefaultDelete.h AK+Everywhere: Move custom deleter capability to OwnPtr 2022-12-17 16:00:08 -05:00
Demangle.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
DeprecatedFlyString.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
DeprecatedFlyString.h AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
DeprecatedString.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
DeprecatedString.h AK: Add support for "debug only" formatters 2023-01-13 21:09:26 +00:00
Diagnostics.h AK: Add a helper macro to temporarily ignore diagnostics with _Pragma() 2022-12-06 21:31:00 +00:00
DisjointChunks.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
DistinctNumeric.h AK: Reimplement DistinctNumeric comparison operators using operator<=> 2023-01-07 14:51:04 +01:00
DoublyLinkedList.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Endian.h AK: Make BigEndian<> and LittleEndian<> work with enum classes 2022-12-28 20:13:12 +00:00
EnumBits.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
Error.h Everywhere: Remove "LibC/" includes, add lint-rule against it 2023-01-07 10:01:37 -07:00
ExtraMathConstants.h
FileStream.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Find.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
FixedArray.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
FixedPoint.h Everywhere: Remove unused includes of AK/Format.h 2023-01-02 20:27:20 -05:00
FloatingPoint.h Everywhere: Remove unused includes of AK/Concepts.h 2023-01-02 20:27:20 -05:00
FloatingPointStringConversions.cpp Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
FloatingPointStringConversions.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
FlyString.cpp AK: Implement FlyString for the new String class 2023-01-12 11:23:58 +01:00
FlyString.h AK: Implement FlyString for the new String class 2023-01-12 11:23:58 +01:00
Format.cpp AK: Support fixed point formatting to print real numbers 2023-01-06 16:05:13 +01:00
Format.h AK: Add support for "debug only" formatters 2023-01-13 21:09:26 +00:00
Forward.h AK: Remove CircularDuplexStream 2023-01-14 12:05:52 -05:00
FPControl.h AK: Add a cpp-y, more fine grained version of fenv.h: FPControl.h 2022-05-07 20:27:05 +02:00
Function.h Everywhere: Stop shoving things into ::std and mentioning them as such 2022-12-14 11:44:32 +01:00
FuzzyMatch.cpp AK: Do not require an allocated String for fuzzy matching 2022-09-20 11:08:54 +01:00
FuzzyMatch.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
GenericLexer.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
GenericLexer.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
GenericShorthands.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
HashFunctions.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
HashMap.h AK: Add a try_ensure() method to HashMap 2022-12-16 10:41:56 -07:00
HashTable.h AK: Support popping an arbitrary element from a HashTable 2022-12-16 10:41:56 -07:00
Hex.cpp Everywhere: Remove unused includes of AK/Array.h 2023-01-02 20:08:35 +00:00
Hex.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
IDAllocator.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
InsertionSort.h AK: Introduce cutoff to insertion sort for Quicksort 2022-12-12 15:03:57 +00:00
IntegralMath.h AK: Implement FloatExtractor<f128> 2022-12-02 16:22:51 +01:00
IntrusiveDetails.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
IntrusiveList.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
IntrusiveListRelaxedConst.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
IntrusiveRedBlackTree.h Everywhere: Remove unnecessary AK and Detail namespace scoping 2022-12-09 11:25:30 +00:00
IPv4Address.h AK: Don't inherit Formatter<ErrorOr<T>> for Formatter<IPv4Address> 2023-01-13 21:09:26 +00:00
IPv6Address.h AK: Don't inherit Formatter<ErrorOr<T>> for Formatter<IPv6Address> 2023-01-13 21:09:26 +00:00
IterationDecision.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Iterator.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
JsonArray.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
JsonArraySerializer.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
JsonObject.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
JsonObjectSerializer.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
JsonParser.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
JsonParser.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
JsonPath.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
JsonPath.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
JsonValue.cpp AK: Disallow implicit pointer-to-boolean conversion in JsonValue 2022-12-09 00:05:30 +01:00
JsonValue.h AK: Disallow implicit pointer-to-boolean conversion in JsonValue 2022-12-09 00:05:30 +01:00
kmalloc.cpp Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY 2022-10-10 12:23:12 +02:00
kmalloc.h AK: Fully qualify some usages of AK features outside of the AK namespace 2022-11-27 23:54:40 +01:00
kstdio.h Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY 2022-10-10 12:23:12 +02:00
LEB128.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
LexicalPath.cpp AK: Create relative path even if prefix is not an ancestor of the path 2022-12-14 15:11:03 +00:00
LexicalPath.h AK: Add LexicalPath::is_child_of 2022-12-11 16:05:23 +00:00
MACAddress.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Math.h AK: Reorder AK/Math after the removal of i686 2023-01-09 11:36:21 +01:00
MemMem.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Memory.h Everywhere: Remove unused includes of LibC/stdlib.h 2023-01-02 20:27:20 -05:00
MemoryStream.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
NeverDestroyed.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
NoAllocationGuard.h AK: Restrict include of LibC header 2023-01-07 10:01:37 -07:00
Noncopyable.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
NonnullOwnPtr.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
NonnullOwnPtrVector.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
NonnullPtrVector.h AK: Allow creating NonnullPtrVectors from an initializer list 2022-09-08 18:53:08 +02:00
NonnullRefPtr.h AK+Everywhere: Move custom deleter capability to OwnPtr 2022-12-17 16:00:08 -05:00
NonnullRefPtrVector.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
NumberFormat.cpp AK: Add an option to format numbers with 1000 based units 2023-01-02 20:11:18 +00:00
NumberFormat.h AK: Add an option to format numbers with 1000 based units 2023-01-02 20:11:18 +00:00
NumericLimits.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Optional.h AK: Add Optional::lazy_emplace(Callable) 2022-12-11 20:44:54 +03:30
OwnPtr.h AK+Everywhere: Move custom deleter capability to OwnPtr 2022-12-17 16:00:08 -05:00
Platform.h AK: Remove ARCH(I386) macro 2022-12-28 11:53:41 +01:00
PrintfImplementation.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Ptr32.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Queue.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
QuickSort.h AK: Change quicksort comments to standard // style 2022-12-12 15:03:57 +00:00
Random.cpp
Random.h AK: Add a shuffle utility function 2022-12-12 16:23:03 +00:00
RecursionDecision.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
RedBlackTree.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
RefCounted.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
RefCountForwarder.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
RefPtr.h AK: Export adopt_nonnull_ref_or_enomem to the global namespace 2023-01-06 16:03:50 +01:00
Result.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
ReverseIterator.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
ScopedValueRollback.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
ScopeGuard.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
ScopeLogger.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
SIMD.h AK: Add char SIMD types 2021-07-22 23:33:21 +02:00
SIMDExtras.h LibGfx: Implement PNG filtering on write 2022-07-10 15:01:07 +02:00
SIMDMath.h AK: Remove i686 support 2022-12-28 11:53:41 +01:00
Singleton.h Kernel: Turn lock ranks into template parameters 2023-01-02 18:15:27 -05:00
SinglyLinkedList.h AK: Combine SinglyLinkedList and SinglyLinkedListWithCount 2023-01-02 20:13:24 +00:00
SinglyLinkedListSizePolicy.h AK: Combine SinglyLinkedList and SinglyLinkedListWithCount 2023-01-02 20:13:24 +00:00
SourceGenerator.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
SourceLocation.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Span.h AK: Add Span::first() 2023-01-10 10:25:58 +01:00
Stack.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
StackInfo.cpp Everywhere: Add support for compilation under emscripten 2022-11-26 02:23:15 +03:30
StackInfo.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Statistics.h AK: Make Statistics::median return a mean for an even number of values 2023-01-07 12:40:47 +01:00
StdLibExtraDetails.h Everywhere: Remove unnecessary AK and Detail namespace scoping 2022-12-09 11:25:30 +00:00
StdLibExtras.h AK: Bring back the AK_DONT_REPLACE_STD #define 2022-12-14 12:56:01 +01:00
Stream.h Everywhere: Remove unnecessary AK and Detail namespace scoping 2022-12-09 11:25:30 +00:00
String.cpp AK: Add String::contains 2023-01-15 01:00:20 +00:00
String.h AK: Add String::to_number 2023-01-15 01:00:20 +00:00
StringBuilder.cpp AK: Make StringBuilder::try_append_code_point actually fallible 2023-01-08 12:13:15 +01:00
StringBuilder.h AK: Add StringBuilder::try_join() 2023-01-14 12:37:00 +01:00
StringFloatingPointConversions.cpp Everywhere: Fix a few comment typos 2022-11-09 16:00:32 +00:00
StringFloatingPointConversions.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
StringHash.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
StringImpl.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
StringImpl.h AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
StringUtils.cpp Everywhere: Remove unused includes of AK/Memory.h 2023-01-02 20:27:20 -05:00
StringUtils.h AK: Add DeprecatedString::find_last(StringView) 2022-12-20 11:24:05 +01:00
StringView.cpp AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
StringView.h AK+Tests: Make CaseInsensitiveStringViewTraits work with HashMap again 2023-01-14 15:43:27 -07:00
TemporaryChange.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Time.cpp AK: Reimplement comparisons on AK::Time using operator<=> 2023-01-07 14:51:04 +01:00
Time.h AK: Reimplement comparisons on AK::Time using operator<=> 2023-01-07 14:51:04 +01:00
Traits.h Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
Trie.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Try.h Everywhere: Fully qualify IsLvalueReference in TRY() macros 2023-01-15 00:56:31 +00:00
Tuple.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
TypeCasts.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
TypedTransfer.h Everywhere: Stop shoving things into ::std and mentioning them as such 2022-12-14 11:44:32 +01:00
TypeList.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Types.h Everywhere: Remove unused includes of AK/IterationDecision.h 2023-01-02 20:08:35 +00:00
UBSanitizer.h Everywhere: Fix badly-formatted includes 2023-01-02 11:06:15 -05:00
UFixedBigInt.h Everywhere: Remove unnecessary AK and Detail namespace scoping 2022-12-09 11:25:30 +00:00
UnicodeUtils.h AK: Make StringBuilder::try_append_code_point actually fallible 2023-01-08 12:13:15 +01:00
URL.cpp AK: Remove tilde from URL::PercentEncodeSet::EncodeURI 2022-12-26 04:51:55 +03:30
URL.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
URLParser.cpp AK: Use base URL when the specified URL is empty 2023-01-06 13:59:17 -07:00
URLParser.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
Userspace.h Everywhere: Remove unused includes of AK/StdLibExtras.h 2023-01-02 20:27:20 -05:00
Utf8View.cpp AK: Add Utf8View::iterator_at_byte_offset_without_validation() 2022-11-24 16:06:20 +00:00
Utf8View.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
Utf16View.cpp AK: Add Utf16View::to_utf8 to convert the view to a UTF-8 AK::String 2023-01-09 23:00:24 +00:00
Utf16View.h AK: Add Utf16View::to_utf8 to convert the view to a UTF-8 AK::String 2023-01-09 23:00:24 +00:00
Utf32View.h AK: Make it possible to not using AK classes into the global namespace 2022-11-26 15:51:34 +01:00
UUID.cpp AK: Stop using DeprecatedString in UUID 2022-12-20 10:34:19 +01:00
UUID.h AK: Stop using DeprecatedString in UUID 2022-12-20 10:34:19 +01:00
Variant.h AK: Specialize TypeList for Variant types 2022-12-26 09:36:16 +01:00
Vector.h AK: Add Vector::shrink_to_fit() 2022-12-08 23:36:17 +00:00
Weakable.h Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
WeakPtr.h Everywhere: Stop shoving things into ::std and mentioning them as such 2022-12-14 11:44:32 +01:00