You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Autoharness: generate &Wtf8 values with unpaired surrogates #4859
Requested feature: generate &Wtf8 values that hold unpaired surrogate code points. Autoharness would then cover the half of WTF-8 that &str cannot express.
Use case: #4809 generates &Wtf8 as Wtf8::from_str over the bounded &str model, so it explores only the UTF-8 subset. In review of #4809, @feliperodri measured a cover for a lone surrogate (ED A0..BF ..) as unsatisfiable. So the methods that exist because of surrogates, such as Wtf8::next_surrogate, encode_wide and code_points, are verified only on inputs where their surrogate handling does nothing.
#![feature(wtf8_internals)]use core::wtf8::Wtf8;// With the #4809 model this cover is unsatisfiable.pubfnhas_surrogate(s:&Wtf8) -> bool{let b = s.as_bytes();
kani::cover!(b.len() >= 3 && b[0] == 0xED && b[1] >= 0xA0);
b.len() >= 3 && b[0] == 0xED && b[1] >= 0xA0}
A model could draw a nondeterministic sequence of code points with CodePoint::from_u32, which accepts surrogates, and build the value with Wtf8::from_bytes_unchecked. The encoder has to merge a lead surrogate followed by a trail surrogate into one 4-byte sequence. Otherwise the bytes are not well-formed WTF-8, and results would be unsound. Encoding each code point on its own is not enough.
Activity
Autoharness: support `&Wtf8` arguments under --bounded-arguments (mod…
Autoharness: generate `&Wtf8` values with unpaired surrogates (model-…