Skip to content

refactor: add overflow-safe CeilDiv helper and use it in unsigned callsites #293

Description

@kevkevinpal

mentioned in: bitcoin#34436

"> ```shell

fuzz: util/overflow.h:64: auto CeilDiv(const Dividend, const Divisor) [Dividend = long, Divisor = int]: Assertion `dividend >= 0 && divisor > 0' failed.

Yeah, a few places (e.g. GetVirtualTransactionSize) were replaced originally in the PR, but turns out fuzzers sometimes create negative amounts for these - not sure if that's possible in reality so I've reverted that one.
Sorry for all the pushes, the extra validations in the new CeilDiv trigger a lot of these (invalid?) edge cases - so we can investigate and possibly migrate them in follow-up PRs instead." - l0rinc

Metadata

Metadata

Assignees

No one assigned

    Labels

    followupThis is a possible follow-up someone can work onneed to confirmNeed to confirm if this is still needed or already done

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions