www.digitalmars.com         C & C++   DMDScript  

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


          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;

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 2021