| Anonymous | Login | Signup for a new account | 2013-05-18 13:23 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0004321 | OCaml | OCaml general | public | 2007-06-20 19:53 | 2008-09-10 17:35 | |||
| Reporter | till | |||||||
| Assigned To | weis | |||||||
| Priority | normal | Severity | crash | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.10.0 | |||||||
| Target Version | Fixed in Version | 3.11+dev | ||||||
| Summary | 0004321: Scanf ignores possitional parameters parsing format strings... | |||||||
| Description | >Scanf.sscanf "\"%2$s %1$i\"" "%{%s %i%}" (fun _ -> ());; doesn't raise any exception while: >Scanf.sscanf "\"%2$i %1$s\"" "%{%s %i%}" (fun _ -> ());; raises one.... | |||||||
| Additional Information | I consider this bug to be critical since it can be exploited in some application to cause ocaml to segfault, for instance, in i18n it is frequent to get format strings from separate files... consider: let f s = Scanf.sscanf s "Toto %{%c %s%}" (fun f ->Printf.printf f 'x' "123");; let _ = f "Toto \"%2$c=%1$s\"";; | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0004094) Christophe Troestler (reporter) 2007-06-21 19:21 |
Related to bug 0003992 |
|
(0004251) weis (developer) 2007-11-09 17:26 |
According to its documentation, the Scanf module is not supposed to accept any positional parameters specification in the format strings. So, raising an exception is the correct and expected behaviour. Indeed, the static type-checker also rejects positional parameters, as examplify here: # format_of_string "%1$s";; Bad conversion %$, at char number 0 in format string ``%1$s'' Despite those checks, your example leads to the production of a format string value with positional parameters in it, by-passing the typechecker checks and the Scanf checks! This is due to a bug in the function that performs the dynamic type-checking verification for format strings which I will correct very soon. |
|
(0004605) doligez (manager) 2008-09-10 17:35 |
Quick fix: remove positional parameters in printf/scanf. They will come back when we manage to make them work perfectly. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2007-06-20 19:53 | till | New Issue | |
| 2007-06-21 19:21 | Christophe Troestler | Note Added: 0004094 | |
| 2007-11-09 17:08 | weis | Description Updated | |
| 2007-11-09 17:26 | weis | Note Added: 0004251 | |
| 2007-11-09 17:31 | weis | Assigned To | => weis |
| 2007-11-09 17:31 | weis | Status | new => confirmed |
| 2008-09-10 17:05 | doligez | Relationship added | related to 0003992 |
| 2008-09-10 17:35 | doligez | Note Added: 0004605 | |
| 2008-09-10 17:35 | doligez | Status | confirmed => closed |
| 2008-09-10 17:35 | doligez | Resolution | open => fixed |
| 2008-09-10 17:35 | doligez | Fixed in Version | => 3.11+dev |
| Copyright © 2000 - 2011 MantisBT Group |