do not allow strings containing null characters to be inlined (#2848)
This commit is contained in:
@@ -467,7 +467,7 @@ impl AtomTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_with(atom_table: &AtomTable, string: &str) -> Atom {
|
pub fn build_with(atom_table: &AtomTable, string: &str) -> Atom {
|
||||||
if 0 < string.len() && string.len() <= INLINED_ATOM_MAX_LEN {
|
if 0 < string.len() && string.len() <= INLINED_ATOM_MAX_LEN && !string.contains('\u{0}') {
|
||||||
return Atom::new_inlined(string);
|
return Atom::new_inlined(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ print_comma_separated_list([VN=_, VNEq | VNEqs]) :-
|
|||||||
|
|
||||||
filter_anonymous_vars([], []).
|
filter_anonymous_vars([], []).
|
||||||
filter_anonymous_vars([VN=V | VNEqs0], VNEqs) :-
|
filter_anonymous_vars([VN=V | VNEqs0], VNEqs) :-
|
||||||
'$debug_hook',
|
|
||||||
( atom_concat('_', _, VN) ->
|
( atom_concat('_', _, VN) ->
|
||||||
filter_anonymous_vars(VNEqs0, VNEqs)
|
filter_anonymous_vars(VNEqs0, VNEqs)
|
||||||
; VNEqs = [VN=V | VNEqs1],
|
; VNEqs = [VN=V | VNEqs1],
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ impl ConsPtr {
|
|||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn as_ptr(self) -> *mut u8 {
|
pub fn as_ptr(self) -> *mut u8 {
|
||||||
unsafe { mem::transmute::<_, *mut u8>(self.ptr()) }
|
let addr: u64 = self.ptr();
|
||||||
|
addr as usize as *mut _
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|||||||
@@ -761,8 +761,7 @@ test_171 :- writeq_term_to_chars("a", C),
|
|||||||
|
|
||||||
test_229 :- test_syntax_error("\"\\z.\"", syntax_error(missing_quote)).
|
test_229 :- test_syntax_error("\"\\z.\"", syntax_error(missing_quote)).
|
||||||
|
|
||||||
test_300 :- '$debug_hook',
|
test_300 :- writeq_term_to_chars("\0\", C),
|
||||||
writeq_term_to_chars("\0\", C),
|
|
||||||
C == "['\\x0\\']".
|
C == "['\\x0\\']".
|
||||||
|
|
||||||
test_172 :- X is 10.0** -323,
|
test_172 :- X is 10.0** -323,
|
||||||
|
|||||||
Reference in New Issue
Block a user