You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(stl): allow an empty iterator range when constructing span #4523
The dynamic span iterator-pair constructor unconditionally evaluates &(*begin). For an empty range, begin == end, so this dereferences the end iterator; an empty fl::vector can make that a null dereference.
Repro: fl::vector<int> v; fl::span<int> s(v.begin(), v.end()); should create a zero-length span but invokes undefined behavior.
Proposal
Handle the empty range before dereferencing an iterator, preserving a valid zero-length span.
Acceptance criteria
Add a focused RED→GREEN test for equal non-null pointers and empty-vector iterators, including the debug sanitizer path.
Both forms yield size() == 0 and begin() == end() without dereferencing the end iterator.
Decisions
Scope is the iterator-pair constructor; other span constructors can be audited but are not presumed broken.
Priority: medium; empty ranges are routine and undefined behavior is unacceptable.
Activity