]> Repositorios git - scryer-prolog.git/commitdiff
do not allow strings containing null characters to be inlined (#2848)
authorMark Thom <[email protected]>
Thu, 10 Apr 2025 06:03:28 +0000 (23:03 -0700)
committerMark Thom <[email protected]>
Tue, 8 Jul 2025 05:38:12 +0000 (22:38 -0700)
src/atom_table.rs
src/loader.pl
src/types.rs
tests-pl/iso-conformity-tests.pl

index 09922b1729b1165db1ba31fec0eda34a5be10972..c9abafb76abcebf066a09cdf7d8d3b95aaecdbbe 100644 (file)
@@ -467,7 +467,7 @@ impl AtomTable {
     }
 
     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);
         }
 
index 2a5e9fb84a209b9f0c29f8943e75f7ccab52000e..f2d77009f485e99eeddf97f2a48b447fd0d0356f 100644 (file)
@@ -177,7 +177,6 @@ print_comma_separated_list([VN=_, VNEq | VNEqs]) :-
 
 filter_anonymous_vars([], []).
 filter_anonymous_vars([VN=V | VNEqs0], VNEqs) :-
-    '$debug_hook',
     (  atom_concat('_', _, VN) ->
        filter_anonymous_vars(VNEqs0, VNEqs)
     ;  VNEqs = [VN=V | VNEqs1],
index e356016b88e8a6b535b155541843d5a07ba05d6b..8c989d9bd1df7772698d738b30bb981de9338d61 100644 (file)
@@ -101,7 +101,8 @@ impl ConsPtr {
 
     #[inline(always)]
     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)]
index eea347ccd96050f1b3977e42ce0ef441aa814204..10b85c10dae2acd6314d1b430f3ae4dad81a37cd 100644 (file)
@@ -761,8 +761,7 @@ test_171 :- writeq_term_to_chars("a", C),
 
 test_229 :- test_syntax_error("\"\\z.\"", syntax_error(missing_quote)).
 
-test_300 :- '$debug_hook',
-            writeq_term_to_chars("\0\", C),
+test_300 :- writeq_term_to_chars("\0\", C),
             C == "['\\x0\\']".
 
 test_172 :- X is 10.0** -323,