Bug 21679 – Assertion failure in Base64.encoder for empty input range of ranges

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-03-04T11:11:49Z
Last change time
2021-03-08T14:20:28Z
Keywords
pull
Assigned to
No Owner
Creator
Sönke Ludwig

Comments

Comment #0 by sludwig — 2021-03-04T11:11:49Z
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[]
Comment #1 by dlang-bot — 2021-03-08T13:41:07Z
@berni44 created dlang/phobos pull request #7832 "Fix Issue 21679 - Assertion failure in Base64.encoder for empty input…" fixing this issue: - Fix Issue 21679 - Assertion failure in Base64.encoder for empty input range of ranges https://github.com/dlang/phobos/pull/7832
Comment #2 by dlang-bot — 2021-03-08T14:20:28Z
dlang/phobos pull request #7832 "Fix Issue 21679 - Assertion failure in Base64.encoder for empty input…" was merged into master: - 536aae3d88f4fc72ee1488d7bf6fc01fd2af92aa by berni44: Fix Issue 21679 - Assertion failure in Base64.encoder for empty input range of ranges https://github.com/dlang/phobos/pull/7832