www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21679] New: Assertion failure in Base64.encoder for empty

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 puremagic.com
          Reporter: sludwig 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[]

--
Mar 04