Skip to content

Crash when logging with empty string: unhandled exception: index out of bounds: 1..42 notin 0..41 [IndexDefect] #178

@tersec

Description

@tersec
import chronicles
info "B"
info ""

results in

INF 2025-08-12 01:29:21.788+00:00 B                                          tid=442905
nimbus-eth2/vendor/nim-chronicles/chronicles/textlines.nim(282) w
nimbus-eth2/vendor/nim-chronicles/chronicles/textlines.nim(153) initLogRecord
nimbus-eth2/vendor/nimbus-build-system/vendor/Nim/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: index out of bounds: 1..42 notin 0..41 [IndexDefect]

Presumably due to

if msg.len < msgWidth:
r.stream.write(spaces.toOpenArray(1, msgWidth - msg.len))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions