Skip to content

Hledger supports big enough numbers that it effectively stalls #2490

@Guvante

Description

@Guvante

I have a few cats that will occasionally walk on my keyboard, sometimes it results in weird inputs to whatever text editor I have open. Normally it results in build failures or "undefined characters" or such.

This time however it was somehow both "valid" (no errors were reported) but invalid in that the program spun (100% CPU for 38 minutes before I noticed) while trying to calculate the result of hledger balance.

Specifically the cursor was on a balance = $0.00 and the cat managed to turn that into = $0.004e111111111111111111111111111111111

I suspect this resulted in something in the stack trying to create the number with (if I counted right) a something on the order of a hundred nonillion zeros.

2025-10-29 * Example
    asset     $0.00 = $0.004e111111111

Is a reproducible example, removing a 1 makes it run relatively fast, removing multiple 1s makes it sub second but at this number it takes 1m54.133s on my machine to manage to output the ludicrous number of zeros involved.
Thanks for helping to make hledger better.

Version 1.40, linux-86_64 installed via the 25.05 NixPkgs on NixOS

And just to call it out I don't know if this is a bug perse but I always report when I accidentally cause a program to stall out like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.journalThe journal file format, and its features.performanceAnything performance-related (run time, memory usage, disk space..)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions