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

Incorrect/unwanted behavior on invalid string inputs #4885

Closed
vicuna opened this issue Oct 3, 2009 · 3 comments
Closed

Incorrect/unwanted behavior on invalid string inputs #4885

vicuna opened this issue Oct 3, 2009 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Oct 3, 2009

Original bug ID: 4885
Reporter: yoiwa
Assigned to: @bobzhang
Status: closed (set by @diml on 2016-12-07T17:25:07Z)
Resolution: suspended
Priority: normal
Severity: minor
Target version: undecided
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Tags: patch
Monitored by: @ygrek yoiwa

Bug description

There are two unwanted behaviors on the treatment of string literals in camlp4.

(1) Incomplete decimal/hexadecimal character escapes cause unspecified errors.

$ echo '"\0"' | camlp4o -impl /dev/stdin
Warning: File "/dev/stdin", line 1, characters 1-3: Illegal backslash escape in string or character (0)
Parse error:
$

(2) Other unharmful character escapes which are undefined in Caml syntax was useful for camlp4 extensions until 3.09, but now it produces a warning even when these are handled later by syntax extensions. Several useful syntax extensions depend on 3.09 behavior. To achieve both compatibility and safety, such checking is better to be implemented in parser (or output) instead of in lexer. The attached patch (against 3.12.0+dev5) implements the string constant validity checking in the parser stage, as well as fixing problem (1).

File attachments

@vicuna
Copy link
Author

vicuna commented Oct 5, 2009

Comment author: yoiwa

I updated the patch to solve an issue with antiquotations.

@vicuna
Copy link
Author

vicuna commented Jul 28, 2013

Comment author: @bobzhang

Hi, yoiwa, since this is a feature not used in common scenarios, would you provide some examples to justify this change? thanks

@vicuna
Copy link
Author

vicuna commented Jan 9, 2015

Comment author: @damiendoligez

Transferred to camlp4/camlp4#68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant