Skip to content

Potential Overflow Problem in header-length check #40

@Koukyosyumei

Description

@Koukyosyumei

Thank you for this fantastic project!

I noticed that the TwitterVerifier template implemented in Circom might not properly validate whether index < header-length. For instance:

signal isFromIndexValid <== LessThan(log2Ceil(maxHeadersLength))([fromEmailIndex, emailHeaderLength]);

In this case, if fromEmailIndex = 21888242871839275222246405745257275088548364400416034343698204186575808495614 and emailHeaderLength = 3, the circuit results in isFromIndexValid = 1.

To address this, we should validate the bit-length of both fromEmailIndex and emailHeaderLength using Num2Bits.

If this is acknowledged as a potential bug, I’d be happy to submit a PR with a fix.

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