d1961e79fc
Integrate 182 upstream commits throughb2473e60while retaining MoonWell packaging, branding and the community ruRU pack. Upstream replaces the C Lua/mlua host with benilla-lua/benilla-mlua and the native glue screens with stock GlueXML. The update also includes the new locale/DBC/name rules, cache and interaction handling, rendering, quest log and chat behavior, including the latest quest completion and timed-quest failure fixes. Fork adaptations use the new APIs: stock Wow.ini locales remain intact, while the ruRU overlay reads column zero and retains its ruRU authentication tag and Lua identity. Russian names keep their twelve-letter policy and Unicode roster matching; fonts, spell costs, race/class labels and translated options retain real-pack regression coverage. Windows regression fixes keep the locale-default test valid under instrumented window overrides and the shader assertion independent of checkout line endings. The original C Lua 5.1 host, rebuilt fromc0630f3din an isolated directory, reproduces the complete Windows cos-sweep answer byte for byte; cos now uses platform-specific goldens. Validation on Windows: scripts/gates.sh passed all automatic gates, including real-data and no-install workspace tests, reference tables, documentation, message catalog, render-pass lint, player clippy/tests and engine boots with and without data. MoonWell player clippy also passed with -D warnings. The committed tree exactly matches the full green stamp; five vendored Kira files retain the tested checkout's line endings, with normalized contents unchanged. All three actual ruRU pack regressions passed in both builds. Fifteen test archives were restored read-only from the published client and SHA-256 checked. Each real-data/player rung skipped 31 tests because the optional addon corpus is absent (24 general, 7 Quiver). Live smoke was not run: no declared probe account; no player-account login or character creation was performed. Linux/macOS changes were not locally built.
57 lines
1.7 KiB
Rust
57 lines
1.7 KiB
Rust
//! A heap handle is a plain index anyone can build. One to no live object, stale or made up,
|
|
//! reads some object of the right type in a release build and panics in a debug one; it never
|
|
//! reads freed or out-of-bounds memory.
|
|
|
|
use benilla_lua::heap::Heap;
|
|
use benilla_lua::value::{FuncRef, StrRef, TableRef, UserRef};
|
|
|
|
/// `f`'s answer, or `None` where a debug build's check panicked.
|
|
fn read<T>(f: impl FnOnce() -> T) -> Option<T> {
|
|
let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(f));
|
|
assert!(
|
|
r.is_ok() || cfg!(debug_assertions),
|
|
"only a debug build's handle check panics"
|
|
);
|
|
r.ok()
|
|
}
|
|
|
|
#[test]
|
|
fn a_made_up_handle_reads_no_memory_outside_the_heap() {
|
|
for i in [0, 1, 63, 64, 1 << 20, u32::MAX] {
|
|
let heap = Heap::default();
|
|
read(|| heap.table(TableRef(i)).meta.is_some());
|
|
read(|| {
|
|
matches!(
|
|
heap.func(FuncRef(i)),
|
|
benilla_lua::heap::FuncObj::Native { .. }
|
|
)
|
|
});
|
|
read(|| heap.user(UserRef(i)).tag);
|
|
read(|| heap.upval(i));
|
|
read(|| {
|
|
heap.str(StrRef {
|
|
id: i & 0xff_ffff,
|
|
hash: 0,
|
|
})
|
|
.len()
|
|
});
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn a_stale_handle_reads_no_freed_memory() {
|
|
let mut vm = benilla_lua::new_state();
|
|
let t = vm.heap.new_table(0, 4);
|
|
let k = vm.str(b"key");
|
|
vm.heap.table_mut(t).set(k, k).unwrap();
|
|
vm.full_gc();
|
|
// Nothing held the table: its slot is free, then taken by others.
|
|
let heap = vm.heap.clone();
|
|
read(move || heap.table(t).meta.is_some());
|
|
for _ in 0..100 {
|
|
vm.heap.new_table(0, 0);
|
|
}
|
|
let heap = vm.heap.clone();
|
|
read(move || heap.table(t).meta.is_some());
|
|
}
|