[Issue 21679] New: Assertion failure in Base64.encoder for empty input range of ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 4 11:11:49 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21679

          Issue ID: 21679
           Summary: Assertion failure in Base64.encoder for empty input
                    range of ranges
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: sludwig at outerproduct.org

Passing an empty range of chunks to Base64.encoder unconditionally accesses the
`.front` of the chunk range, resulting in the following code to fail with an
assertion error:

---
import std;
void main()
{
    ubyte[][] input;
    assert(Base64.encoder(input).empty);
}
---

core.exception.AssertError@/dlang/dmd/linux/bin64/../../src/phobos/std/range/primitives.d(2432):
Attempting to fetch the front of an empty array of ubyte[]

--


More information about the Digitalmars-d-bugs mailing list