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

new parser hangs on some syntax errors #7847

Closed
vicuna opened this issue Sep 3, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Sep 3, 2018

Original bug ID: 7847
Reporter: smuenzel-js
Assigned to: @gasche
Status: resolved (set by @gasche on 2018-09-06T08:18:14Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.07.0
Fixed in version: 4.08.0+dev/beta1/beta2
Category: lexing and parsing
Monitored by: smuenzel-js @nojb @hhugo @gasche

Bug description

The following code results in a hang (in Parse.ml, around line 109):

external x : unit -> (int,int)`A.t = "x"

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 3, 2018

Comment author: @gasche

Thanks for the report!

The nontermination comes from the Parse.loop function, which seems to hit the HandlingError case infinitely often instead of progressing towards Rejected.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 3, 2018

Comment author: @gasche

smuenzel-js: out of curiosity, how did you hit this issue? I'm curious at whether this comes from tests that you are running on your own, or casual usage of trunk. In any case, this is very useful.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 3, 2018

Comment author: @hhugo

The is the result of some experiment with afl fuzz

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 3, 2018

Comment author: @gasche

Interesting! I hope that the harness setup will be made available for others to play with.

(I have a perpetually-delayed side-project idea to do differential testing of OCaml implementations by combining https://github.com/jmid/efftester (the evaluation-order-aware code generator) and https://github.com/johnwhitington/ocamli (or another reference implementation.)

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 6, 2018

Comment author: @gasche

After some debugging by Frédéric Bour and myself, the issue was fixed by François Pottier in trunk:

#2019

We believe that no other similar issue should pop up in the future with the current grammar, as it is due to a corner case (raising a parser-internal exception from a semantic action) which has now disappeared from the grammar.

Thanks again for the prompt testing and reporting!

@vicuna vicuna closed this Sep 6, 2018

hhugo pushed a commit to hhugo/ocaml that referenced this issue Mar 17, 2019

Parser: in the definition of [simple_core_type], replace
[core_type_comma_list] with [core_type], as this is what is really intended:
allow a single type. This removes the need for raising [Parsing.Parse_error]
in the semantic action, and should fix bug ocaml#7847. This change alone would
create a conflict in the grammar, which is avoided by replacing
[core_type_comma_list] with [inline_core_type_comma_list] in two places.

hhugo pushed a commit to hhugo/ocaml that referenced this issue Mar 17, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.