Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzer bug test_syntax "after formatting, the source code no longer parsed" #7358

Closed
lukewilliamboswell opened this issue Dec 13, 2024 · 0 comments · Fixed by #7368
Closed
Assignees
Labels
bug Something isn't working formatting Relates to the roc formatter parsing Relates to the Parsing compiler stage

Comments

@lukewilliamboswell
Copy link
Collaborator

Run on @joshuawarner32's branch for #7353

$ cargo run --bin minimize expr todo
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/minimize expr todo`
Error found: Reparse failed: Expr(Record(End(@0), @0), @0)
Proceeding with minimization
Successfully minimized, new length: 72
Successfully minimized, new length: 71
Successfully minimized, new length: 64
Successfully minimized, new length: 58
Successfully minimized, new length: 53
Successfully minimized, new length: 48
Successfully minimized, new length: 43
Successfully minimized, new length: 39
Successfully minimized, new length: 36
Successfully minimized, new length: 33
Successfully minimized, new length: 31
Successfully minimized, new length: 29
Successfully minimized, new length: 28
Successfully minimized, new length: 27
Successfully minimized, new length: 26
No more minimizations found
Final result:
M{s?s{J&
}}{s?s{J&
}}:p
y
thread '<unnamed>' panicked at /Users/luke/Documents/GitHub/roc/crates/compiler/test_syntax/src/test_helpers.rs:333:13:
After formatting, the source code no longer parsed!

Parse error was: Expr(Record(End(@119), @100), @0)

The original code was:

Mxpsat{pdes?s{J&ta,rvm
?r}}Mxpsat{pdes?s{J&ta,rvm
?r}}Aqelntp:op

OAqelntp:op

O=
Fs
Aqyqy


The code that failed to parse:

Mxpsat { pdes ? s
        { J &
            ta,
            rvm
            ? r,
        } } Mxpsat { pdes ? s
        { J &
            ta,
            rvm
            ? r,
        } } Aqelntp : op

OAqelntp : op

O =
    Fs
Aqyqy

The original ast was:

Expr(
    @0-90 SpaceAfter(
        Defs(
            Defs {
                tags: [
                    EitherIndex(0),
                    EitherIndex(1),
                    EitherIndex(2147483648),
                ],
                regions: [
                    @0-64,
                    @66-77,
                    @79-84,
                ],
                space_before: [
                    Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
                    Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 2 },
                    Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 2 },
                ],
                space_after: [
                    Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
                    Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 0 },
                    Slice<roc_parse::ast::CommentOrNewline> { start: 4, length: 0 },
                ],
                spaces: [
                    Newline,
                    Newline,
                    Newline,
                    Newline,
                ],
                type_defs: [
                    Alias {
                        header: TypeHeader {
                            name: @0-6 "Mxpsat",
                            vars: [
                                @6-27 RecordDestructure(
                                    [
                                        @7-26 OptionalField(
                                            "pdes",
                                            @12-26 Apply(
                                                @12-13 Var {
                                                    module_name: "",
                                                    ident: "s",
                                                },
                                                [
                                                    @13-26 RecordUpdate {
                                                        update: @14-15 Tag(
                                                            "J",
                                                        ),
                                                        fields: [
                                                            @16-18 LabelOnly(
                                                                @16-18 "ta",
                                                            ),
                                                            @19-25 OptionalValue(
                                                                @19-22 "rvm",
                                                                [
                                                                    Newline,
                                                                ],
                                                                @24-25 Var {
                                                                    module_name: "",
                                                                    ident: "r",
                                                                },
                                                            ),
                                                        ],
                                                    },
                                                ],
                                                Space,
                                            ),
                                        ),
                                    ],
                                ),
                                @27-33 Tag(
                                    "Mxpsat",
                                ),
                                @33-54 RecordDestructure(
                                    [
                                        @34-53 OptionalField(
                                            "pdes",
                                            @39-53 Apply(
                                                @39-40 Var {
                                                    module_name: "",
                                                    ident: "s",
                                                },
                                                [
                                                    @40-53 RecordUpdate {
                                                        update: @41-42 Tag(
                                                            "J",
                                                        ),
                                                        fields: [
                                                            @43-45 LabelOnly(
                                                                @43-45 "ta",
                                                            ),
                                                            @46-52 OptionalValue(
                                                                @46-49 "rvm",
                                                                [
                                                                    Newline,
                                                                ],
                                                                @51-52 Var {
                                                                    module_name: "",
                                                                    ident: "r",
                                                                },
                                                            ),
                                                        ],
                                                    },
                                                ],
                                                Space,
                                            ),
                                        ),
                                    ],
                                ),
                                @54-61 Tag(
                                    "Aqelntp",
                                ),
                            ],
                        },
                        ann: @62-64 BoundVariable(
                            "op",
                        ),
                    },
                    Alias {
                        header: TypeHeader {
                            name: @66-74 "OAqelntp",
                            vars: [],
                        },
                        ann: @75-77 BoundVariable(
                            "op",
                        ),
                    },
                ],
                value_defs: [
                    Body(
                        @79-80 Tag(
                            "O",
                        ),
                        @82-84 SpaceBefore(
                            Tag(
                                "Fs",
                            ),
                            [
                                Newline,
                            ],
                        ),
                    ),
                ],
            },
            @85-90 SpaceBefore(
                Tag(
                    "Aqyqy",
                ),
                [
                    Newline,
                ],
            ),
        ),
        [
            Newline,
        ],
    ),
)


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
==2254== ERROR: libFuzzer: deadly signal
NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
MS: 1 CopyPart-; base unit: 03c90bd5fa52f03b184d0dbd5bd88f21a43ba352
0x4d,0x78,0x70,0x73,0x61,0x74,0x7b,0x70,0x64,0x65,0x73,0x3f,0x73,0x7b,0x4a,0x26,0x74,0x61,0x2c,0x72,0x76,0x6d,0xa,0x3f,0x72,0x7d,0x7d,0x4d,0x78,0x70,0x73,0x61,0x74,0x7b,0x70,0x64,0x65,0x73,0x3f,0x73,0x7b,0x4a,0x26,0x74,0x61,0x2c,0x72,0x76,0x6d,0xa,0x3f,0x72,0x7d,0x7d,0x41,0x71,0x65,0x6c,0x6e,0x74,0x70,0x3a,0x6f,0x70,0xa,0xa,0x4f,0x41,0x71,0x65,0x6c,0x6e,0x74,0x70,0x3a,0x6f,0x70,0xa,0xa,0x4f,0x3d,0xa,0x46,0x73,0xa,0x41,0x71,0x79,0x71,0x79,0xa,
Mxpsat{pdes?s{J&ta,rvm\012?r}}Mxpsat{pdes?s{J&ta,rvm\012?r}}Aqelntp:op\012\012OAqelntp:op\012\012O=\012Fs\012Aqyqy\012
artifact_prefix='/Users/luke/Documents/GitHub/roc/crates/compiler/test_syntax/fuzz/artifacts/fuzz_expr/'; Test unit written to /Users/luke/Documents/GitHub/roc/crates/compiler/test_syntax/fuzz/artifacts/fuzz_expr/crash-babf96565ee4a16d60f3f6378048c453c673b1f4
Base64: TXhwc2F0e3BkZXM/c3tKJnRhLHJ2bQo/cn19TXhwc2F0e3BkZXM/c3tKJnRhLHJ2bQo/cn19QXFlbG50cDpvcAoKT0FxZWxudHA6b3AKCk89CkZzCkFxeXF5Cg==
stat::number_of_executed_units: 627430
stat::average_exec_per_sec:     20914
stat::new_units_added:          11069
stat::slowest_unit_time_sec:    0
stat::peak_rss_mb:              432
INFO: exiting: 19712 time: 255s
@lukewilliamboswell lukewilliamboswell added bug Something isn't working formatting Relates to the roc formatter parsing Relates to the Parsing compiler stage labels Dec 13, 2024
joshuawarner32 added a commit to joshuawarner32/roc that referenced this issue Dec 14, 2024
joshuawarner32 added a commit to joshuawarner32/roc that referenced this issue Dec 14, 2024
joshuawarner32 added a commit to joshuawarner32/roc that referenced this issue Dec 15, 2024
joshuawarner32 added a commit to joshuawarner32/roc that referenced this issue Dec 16, 2024
joshuawarner32 added a commit to joshuawarner32/roc that referenced this issue Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatting Relates to the roc formatter parsing Relates to the Parsing compiler stage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants