String literals with '\0' crash Mars

Bug #534159 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Released
High
Matt Giuca

Bug Description

Expected:
?> "a\0b"
[97, 0, 98]

Actual:
?> "a\0b"
Uncaught Mercury exception:
univ_cons(univ_cons(software_error("string.from_char_list: null character in list")))

This is due to a call to string.from_char_list in token.m:tok_stringlit, which crashes Mercury if it has a '\0'. Mercury strings may not have null characters in them; Mars strings can. Therefore, the only solution is to change the type of the stringlit constructor from string to list(char), and update all corresponding code accordingly.

Related branches

Matt Giuca (mgiuca)
Changed in mars:
importance: Medium → High
Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r983.

Changed in mars:
status: Triaged → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.