Repository navigation
Fix overlapping memcpy in CoNgram history shift - #289
Conversation
Default stack is 64 KB and cong-global overflows it on some sentences.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
@ollipa Oh I didn't know that |
Depends on #288 (wasm stack size). This branch is on top of it, so the first commit is from that PR.
CoNgramModel::progress()shifts the distant-token history in place withmemcpy(&history[0], &history[1], ...). The ranges overlap, which is undefined behaviour. glibc happens to handle it, but Emscripten'smemcpycorrupts the history, socong-globalresults in the WASM build differ from native. This PR usesmemmoveinstead.Example:
그는 죄를 지었기 때문에 감옥에 갔다.짓/VV-I 었/EP(−41.00)지/VV 었/EP(−43.88)Testing:
memcpy-param-overlapat this line.Summary by CodeRabbit
Bug Fixes
짓/VV-Iwhen processing a sentence containing지었기.Tests
생각,기도, and지었기.