Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/patches/6171b18d398fd95c # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## fix(authority): refuse trailing bytes in durable store records merged `6171b18d398fd95c` #686 · opened 2026-10-24 09:03 UTC · closed 2026-11-06 04:06 UTC · merged 2026-11-06 04:06 UTC Imported from GitHub aien-dev/omega-mv#686, by drakestapleton Base `727eba45ea0b56d15d086246d62a6753dfb82aaa` · Head `4baf03575616d0e64859ed6b2d1c1426ca7ba62c` Merged on GitHub as `b8991b6c74d02a7d43e7ca3d410b22a85ff4e2f8`; reachable from main `c7acd2607139eedfabeac16b6042cefe8ede431f` (observed 2026-11-18T16:35:46Z) drakestapleton wrote on 2026-10-24 09:03 UTC ## Evidence 2026-10-31 (AuthStack lane, head `4baf03575616d0e64859ed6b2d1c1426ca7ba62c`) Classification vs main `1db94162` (#970): NOT_CONTAINED. #970 squash-merged fix/security673-qualified (head `03ec4baf`, tree `0d4d15a9` == main tree); every commit this stack inherited from it (`dd6c4ad7` and earlier) is an ancestor of `03ec4baf` and is on main. The stack's own changes are not on main (main seed/authority/dispatch.om still calls readrec before lacq; lock.om lrm returns 0 on unlink failure; no store-exact/store-cleanup/dispatch-order gates on main). Base stays as is (parent not merged). Compiler: seed/out/omc sha256 `7a8b84fcc07808a52e6cbb65aa7450c754b3ad62eeddf9ec64cc0edd0938b2de`, reproduced by `sh seed/omega-from-seed.sh` (rc 0, no diff). All runs under `taskset -c 6-9,15-19 nice -n 19 ionice -c3`, Linux AArch64 host (DGX Spark), repo root as cwd. Helper /tmp/prfix/AuthStack-qual.sh; logs /tmp/prfix/AuthStack-logs//. Merged updated #685 (only .crumb conflicts, parent side + recompile); README native results commit `4baf0357`. MEASURED: store-exact-gate `store exact checks=4 fails=0` exit 0; negative controls with store.om from main `1db94162` and from `a35697e9`: both `FAIL store trailing-record refusal` and `FAIL store trailing-generation refusal`, exit 1; store 77, dispatch 37, dispatch-order 3, lock 5 all exit 0; gate669 exit 0 PASS; crumb verify OK 184; zero-disk-secrets exit 0; om-units exit 0. NOT_RUN: hosted CI pending at push. NOT_RUN is not PASS. Host AArch64 runs are not hardware qualification. ## Verification PASS: whitespace checks and exact component concatenation of all four affected gate sources. Independent parent source review checked EOF-probe ordering, unchanged buffer decoding, descriptor close paths, exact-length positives and trailing-byte negatives. NOT_RUN: native compilation, positive/negative control execution, existing runtime gates, full security gate and independent AArch64 replay. Source review is not runtime qualification; keep draft until required gates pass. ## Change At upstream `a35697e94b5eeb72efadfee6edab7f14344aea43`, readrec/readgen accept any file with a valid 256/8-byte prefix, despite the exact-length contract. Probe for EOF after the required bytes; reject extra data or probe errors with existing error codes (record 22, generation sgerr=32). Preserve serialized format and valid input behavior. Add a handwritten .om real-file regression covering exact records/generations and one appended byte. The old-source negative control remains compilable without the new scratch buffer. Regenerate gate concatenations, including the pre-existing stale store-gate copy that lacked the authoritative sgerr interface. Stacked on #685, not a separate authority implementation. Refs #671, #649, #670, #673. No shared compiler, production consumer, historical receipt, locking protocol or deployment change. This does not claim authenticated files, snapshot isolation or general crash durability. Candidate `1a8b42d394a823380d0b37bf778a8555539d83a5`, tree `3524bd7d43b685cc2367bb5dac98ffa8decf1fd6`. Source review note: evidence/SECURITY-673/store-exact-read/REVIEW.md. No automatic issue closure. ### Fetch it A git bundle of the pull request's head, 17039 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/6171b18d398fd95c.bundle -o 6171b18d398fd95c.bundle git fetch 6171b18d398fd95c.bundle refs/pull/686/head ``` Raw bundle · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/omega-mv 686 4baf03575616d0e64859ed6b2d1c1426ca7ba62c ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":686,"url":"https://github.com/aien-dev/omega-mv/pull/686","export_sha256":"7319147b350ad908bf0b731068ec3be7b8dee848041dc862f71455e8e4680140","imported_utc":"2026-11-18T16:35:46Z"} ``` ### Changes ``` diff --git a/.crumb b/.crumb index f4ff64d4f..59286e8e8 100644 --- a/.crumb +++ b/.crumb @@ -108,14 +108,14 @@ } ], "children_root": "sha256:4b14d5958f47b6630055cf4a2246a89549620f97b64495ebf50844cac8cae2f9", - "compiled_at": "2026-10-31T05:01:59Z", + "compiled_at": "2026-10-31T05:02:41Z", "compiler": "crumb-compile/1", - "digest": "sha256:678687ed84785fb091850b4204c170f88c22dd3a139fa5b7f4be27093354de07", - "evidence_files": 14990, - "evidence_root": "sha256:7a010491308d7ab9202880df860a370764dfa9ead62c6b728c1f88ca6921967c", - "files": 23185, - "generated_at_commit": "d1832b802dde96cd051e9765b8ff5c102918dae2", - "source_tree": "sha256:9a53c168575784d0ea76fa63d6a4addc22747425041a4f353f58f3b7b3ef3f98" + "digest": "sha256:0c9346d8bf0cc410efbf1c4861608ccd8bc8128a521489807da6f8c7aec6188f", + "evidence_files": 14991, + "evidence_root": "sha256:1b7f806cd08d07db412b46fe3506748b42e94f87ff330d49cc47364831dff4b8", + "files": 23188, + "generated_at_commit": "7d57fa6bb70b42ab893e7df864180a31755f28c3", + "source_tree": "sha256:46a3f83a82fb0faf8cae952713f5cbcfe07fd18c0a27c2f8dab3cca8c19fc7f2" }, "owner_lane": "", "provenance": { diff --git a/evidence/SECURITY-673/store-exact-read/REVIEW.md b/evidence/SECURITY-673/store-exact-read/REVIEW.md new file mode 100644 index 000000000..ff7c76433 --- /dev/null +++ b/evidence/SECURITY-673/store-exact-read/REVIEW.md @@ -0,0 +1,37 @@ +# Store exact-consumption correction: source-only candidate + +Upstream source: `a35697e94b5eeb72efadfee6edab7f14344aea43` (`fix/security673-qualified`). +Stack parent: `708f5378847deeed6c4854b259c7f4f4b3f9ece2` (dispatcher protected read). +Issue scope: #671 ingress qualification, #649/#670 authority store, #673 tracker. +Review date: 2026-10-24. + +## Finding and correction + +`readrec` read 256 bytes and `readgen` read 8, then closed the descriptor. Neither checked +for remaining bytes. Thus a 257-byte record or 9-byte generation file with a valid prefix +was accepted despite the store's exact-length contract. This is a source-level finding; +no runtime reproduction or exploit claim is made. + +Both parsers now require an EOF result from a one-byte probe before decoding. Extra data +and read errors fail closed through existing length-error codes. The descriptor is closed +on both paths. A new seeded `.om` regression checks exact lengths and a trailing byte for +each parser, using real file operations. Its old-source negative control does not depend +on the new implementation's extra scratch buffer. + +Refresh source concatenations for store, dispatch and dispatch-order gates. Regenerating +store-gate also fixes a previously stale embedded `readgen` implementation: the component +already used `sgerr`, while the committed gate still returned error codes as generations. +No shared compiler, legacy runtime, production consumer, or historical evidence is modified. + +## Verification and limits + +- PASS: `git diff --check` (text/whitespace only). +- PASS: all four affected gate files equal their documented component concatenations. +- NOT_RUN: compiler reconstruction, compilation, positive and negative-control execution, + existing store/dispatch/order gates, full security gate and independent final replay. +- Host: x86_64. Bundled seeds: Linux AArch64 ELF. No bundled executable ran and no toolchain + was installed. These source checks are not functional qualification or native PASS. + +No claim of concurrent-writer snapshot isolation, authenticated/canonical records, symlink +confinement, durability of directory entries, robust pid locking, or production cutover. +Missing review and required gates continue to block merging/release and issue closure. diff --git a/seed/authority/README.md b/seed/authority/README.md index a69a1f3e7..dbd20456a 100644 --- a/seed/authority/README.md +++ b/seed/authority/README.md @@ -96,11 +96,48 @@ reproduced it): positive `dispatch order checks=3 fails=0`, exit 0; negative con from main 1db94162 printed all three `FAIL dispatch ...` lines, exit 1. The 37-check `dispatch-gate.om` passes on both sources, so it does not detect the read-before-acquire order; this regression does. +## Exact store-input consumption regression + +`readrec` accepts exactly 256 bytes and `readgen` accepts exactly 8 bytes. Both now probe for +EOF before decoding. A trailing byte or an error in that probe is refused through the existing +record error (22) or generation error (`sgerr=32`, returned value 0). This is exact stream +consumption, not authentication or a defense against concurrent file replacement/writes. + +`store-exact-gate.om` is exactly `store.om` followed by `store-exact-test.om`. It uses real +store writes/reads and appends a synthetic byte with Linux `O_WRONLY | O_APPEND` (1025). +It checks the exact-length positives and both trailing-byte refusals. In a fresh disposable +Linux AArch64 checkout, using the reconstructed and approved existing compiler: + +```sh +mkdir -p build +seed/out/omc < seed/authority/store-exact-gate.om > build/store-exact-gate +readelf -h build/store-exact-gate +chmod +x build/store-exact-gate +build/store-exact-gate +``` + +Run each command only after its predecessor succeeds. Expected output is +`store exact checks=4 fails=0`, exit 0. The negative control concatenates the unmodified +`store.om` from `a35697e94b5eeb72efadfee6edab7f14344aea43` with this test; it must report +`FAIL store trailing-record refusal` and `FAIL store trailing-generation refusal`, exit 1. +The test deliberately has no dependency on the new EOF-probe scratch buffer, so the old-source +control remains a valid compilation unit. Failed compilation, signals and timeouts are INVALID. +Run the existing store, dispatch, dispatcher-order and complete security gates as regressions. +This standalone gate is not yet wired into `gate669`. Native run (2026-10-31, Linux AArch64, +seed/out/omc 7a8b84fc): positive `store exact checks=4 fails=0`, exit 0; negative controls with +`store.om` from main 1db94162 and from a35697e9 each printed both `FAIL store trailing-...` lines, +exit 1. Store (77), dispatch (37), dispatcher-order (3) and lock (5) gates pass on this revision. + +`store-gate.om` has been regenerated as `store.om` followed by `store-test.om`. Its prior copy +also lacked the already-existing `sgerr` generation-error interface; it now tests the current +implementation rather than preserving that stale copy. + ## Fixture source correction (2026-10-24) The dispatcher-order fixture now uses global/text names within the existing compiler's eight-character limit and copies its scheduled record into a local array before calling `writerec`; global arrays cannot be function arguments. +The exact-store fixture likewise uses global/text names within that limit. These correct known source compilation blockers without changing the test scenarios or production sources. Declared concatenated gates are regenerated from this revision's own component sources. Source review is not compiler diff --git a/seed/authority/dispatch-gate.om b/seed/authority/dispatch-gate.om index 62228fbdb..626d01707 100644 --- a/seed/authority/dispatch-gate.om +++ b/seed/authority/dispatch-gate.om @@ -170,6 +170,7 @@ text recp "build/authority-store/rec" text tmpp "build/authority-store/tmp" text genp "build/authority-store/gen" global sb uchar 256 +global stail uchar 1 global spkt uchar 256 global sn ulong 1 global spath uchar 128 @@ -262,10 +263,14 @@ if lt fd 0 ret 20 end n = read int fd sb 0 256 +extra = long -1 +if eq n 256 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 ret 21 end -if ne n 256 +if or ne n 256 ne extra 0 ret 22 end dv = dec r @@ -280,11 +285,15 @@ put sgerr 0 30 ret 0 end n = read int fd sb 0 8 +extra = long -1 +if eq n 8 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 put sgerr 0 31 ret 0 end -if ne n 8 +if or ne n 8 ne extra 0 put sgerr 0 32 ret 0 end diff --git a/seed/authority/dispatch-order-gate.om b/seed/authority/dispatch-order-gate.om index 0e69ced94..30ad6c40c 100644 --- a/seed/authority/dispatch-order-gate.om +++ b/seed/authority/dispatch-order-gate.om @@ -170,6 +170,7 @@ text recp "build/authority-store/rec" text tmpp "build/authority-store/tmp" text genp "build/authority-store/gen" global sb uchar 256 +global stail uchar 1 global spkt uchar 256 global sn ulong 1 global spath uchar 128 @@ -262,10 +263,14 @@ if lt fd 0 ret 20 end n = read int fd sb 0 256 +extra = long -1 +if eq n 256 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 ret 21 end -if ne n 256 +if or ne n 256 ne extra 0 ret 22 end dv = dec r @@ -280,11 +285,15 @@ put sgerr 0 30 ret 0 end n = read int fd sb 0 8 +extra = long -1 +if eq n 8 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 put sgerr 0 31 ret 0 end -if ne n 8 +if or ne n 8 ne extra 0 put sgerr 0 32 ret 0 end diff --git a/seed/authority/store-exact-gate.om b/seed/authority/store-exact-gate.om new file mode 100644 index 000000000..a94ef12c8 --- /dev/null +++ b/seed/authority/store-exact-gate.om @@ -0,0 +1,249 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Durable 32-word authority record store. Caller supplies the record and generation. +note Writes a temporary 256-byte file, fsyncs it, then atomically renames it into place. +note Reads require exactly 256 bytes; a short or torn file is refused. Store calls do not lock; the +note dispatcher holds lock.om around its read-check-persist window. +text recp "build/authority-store/rec" +text tmpp "build/authority-store/tmp" +text genp "build/authority-store/gen" +global sb uchar 256 +global stail uchar 1 +global spkt uchar 256 +global sn ulong 1 +global spath uchar 128 +global splen ulong 1 +global sgerr ulong 1 +fn put16 v ulong to void +put spkt get sn 0 uchar and v 255 +put spkt add get sn 0 1 uchar shr v 8 +put sn 0 add get sn 0 2 +end +fn setrec to void +put splen 0 len recp +for i ulong len recp +put spath i get recp i +end +end +fn settmp to void +put splen 0 len tmpp +for i ulong len tmpp +put spath i get tmpp i +end +end +fn setgen to void +put splen 0 len genp +for i ulong len genp +put spath i get genp i +end +end +fn pack2 to ulong +put sn 0 0 +put16 2 +put16 len tmpp +for i ulong len tmpp +put spkt add get sn 0 i get tmpp i +end +put sn 0 add get sn 0 len tmpp +put16 len recp +for i ulong len recp +put spkt add get sn 0 i get recp i +end +put sn 0 add get sn 0 len recp +ret get sn 0 +end +fn enc r view ulong 32 to void +for i ulong 32 +v = get r i +for j ulong 8 +put sb add mul i 8 j uchar and shr v mul j 8 255 +end +end +end +fn dec r edit ulong 32 to ulong +for i ulong 32 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get sb add mul i 8 j mul j 8 +end +put r i v +end +ret 0 +end +fn writerec r view ulong 32 to ulong +enc r +settmp +fd = fopen spath 0 get splen 0 577 384 +if lt fd 0 +ret 10 +end +n = write int fd sb 0 256 +if ne n 256 +ret 11 +end +if ne fsync int fd 0 +ret 12 +end +if ne fclose int fd 0 +ret 13 +end +pn = pack2 +rr = renames spkt 0 pn 0 +if lt rr 0 +ret 14 +end +ret 0 +end +fn readrec r edit ulong 32 to ulong +setrec +fd = fopen spath 0 get splen 0 0 0 +if lt fd 0 +ret 20 +end +n = read int fd sb 0 256 +extra = long -1 +if eq n 256 +extra = read int fd stail 0 1 +end +if ne fclose int fd 0 +ret 21 +end +if or ne n 256 ne extra 0 +ret 22 +end +dv = dec r +ret 0 +end +fn readgen to ulong +put sgerr 0 0 +setgen +fd = fopen spath 0 get splen 0 0 0 +if lt fd 0 +put sgerr 0 30 +ret 0 +end +n = read int fd sb 0 8 +extra = long -1 +if eq n 8 +extra = read int fd stail 0 1 +end +if ne fclose int fd 0 +put sgerr 0 31 +ret 0 +end +if or ne n 8 ne extra 0 +put sgerr 0 32 +ret 0 +end +v = ulong 0 +for j ulong 8 +v = or v shl ulong get sb j mul j 8 +end +ret v +end +fn writegen v ulong to ulong +setgen +fd = fopen spath 0 get splen 0 577 384 +if lt fd 0 +ret 40 +end +for j ulong 8 +put sb j uchar and shr v mul j 8 255 +end +n = write int fd sb 0 8 +if ne n 8 +ret 41 +end +if ne fsync int fd 0 +ret 42 +end +if ne fclose int fd 0 +ret 43 +end +ret 0 +end +fn storevalid r view ulong 32 g ulong to ulong +if ne get r 0 1 +ret 51 +end +if ne get r 4 g +ret 52 +end +ret 0 +end +note SPDX-License-Identifier: AGPL-3.0-only +note Actual store parser accepts exact records and refuses one trailing byte. +text exbuild "build" +text exactdir "build/authority-store" +text badrec "FAIL store trailing-record refusal\n" +text badgen "FAIL store trailing-generation refusal\n" +text expass "store exact checks=4 fails=0\n" +global exfails ulong 1 +global extail uchar 1 +fn appendbyte to void +fd = fopen spath 0 get splen 0 1025 384 +if lt fd 0 +exit 90 +end +put extail 0 165 +n = write int fd extail 0 1 +if ne fclose int fd 0 +exit 91 +end +if ne n 1 +exit 92 +end +end +fn main to int +mk = makedir exbuild 0 len exbuild 448 +if not or eq mk 0 eq mk -17 +ret 93 +end +mk = makedir exactdir 0 len exactdir 448 +if not or eq mk 0 eq mk -17 +ret 94 +end +r = new ulong 32 0 +q = new ulong 32 0 +put r 0 1 +put r 4 1 +if ne writerec r 0 +ret 95 +end +if ne readrec q 0 +ret 96 +end +setrec +appendbyte +if ne readrec q 22 +put exfails 0 add get exfails 0 1 +w = write 1 badrec 0 len badrec +if ne w long len badrec +ret 97 +end +end +if ne writegen 1 0 +ret 98 +end +g = readgen +if or ne g 1 ne get sgerr 0 0 +ret 99 +end +setgen +appendbyte +g = readgen +if or ne g 0 ne get sgerr 0 32 +put exfails 0 add get exfails 0 1 +w = write 1 badgen 0 len badgen +if ne w long len badgen +ret 100 +end +end +if ne get exfails 0 0 +ret 1 +end +w = write 1 expass 0 len expass +if ne w long len expass +ret 101 +end +ret 0 +end diff --git a/seed/authority/store-exact-test.om b/seed/authority/store-exact-test.om new file mode 100644 index 000000000..c7e5a2abb --- /dev/null +++ b/seed/authority/store-exact-test.om @@ -0,0 +1,77 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Actual store parser accepts exact records and refuses one trailing byte. +text exbuild "build" +text exactdir "build/authority-store" +text badrec "FAIL store trailing-record refusal\n" +text badgen "FAIL store trailing-generation refusal\n" +text expass "store exact checks=4 fails=0\n" +global exfails ulong 1 +global extail uchar 1 +fn appendbyte to void +fd = fopen spath 0 get splen 0 1025 384 +if lt fd 0 +exit 90 +end +put extail 0 165 +n = write int fd extail 0 1 +if ne fclose int fd 0 +exit 91 +end +if ne n 1 +exit 92 +end +end +fn main to int +mk = makedir exbuild 0 len exbuild 448 +if not or eq mk 0 eq mk -17 +ret 93 +end +mk = makedir exactdir 0 len exactdir 448 +if not or eq mk 0 eq mk -17 +ret 94 +end +r = new ulong 32 0 +q = new ulong 32 0 +put r 0 1 +put r 4 1 +if ne writerec r 0 +ret 95 +end +if ne readrec q 0 +ret 96 +end +setrec +appendbyte +if ne readrec q 22 +put exfails 0 add get exfails 0 1 +w = write 1 badrec 0 len badrec +if ne w long len badrec +ret 97 +end +end +if ne writegen 1 0 +ret 98 +end +g = readgen +if or ne g 1 ne get sgerr 0 0 +ret 99 +end +setgen +appendbyte +g = readgen +if or ne g 0 ne get sgerr 0 32 +put exfails 0 add get exfails 0 1 +w = write 1 badgen 0 len badgen +if ne w long len badgen +ret 100 +end +end +if ne get exfails 0 0 +ret 1 +end +w = write 1 expass 0 len expass +if ne w long len expass +ret 101 +end +ret 0 +end diff --git a/seed/authority/store-gate.om b/seed/authority/store-gate.om index 3861e397b..30700b427 100644 --- a/seed/authority/store-gate.om +++ b/seed/authority/store-gate.om @@ -1,15 +1,18 @@ note SPDX-License-Identifier: AGPL-3.0-only note Durable 32-word authority record store. Caller supplies the record and generation. note Writes a temporary 256-byte file, fsyncs it, then atomically renames it into place. -note Reads require exactly 256 bytes; a short or torn file is refused. No lock is claimed. +note Reads require exactly 256 bytes; a short or torn file is refused. Store calls do not lock; the +note dispatcher holds lock.om around its read-check-persist window. text recp "build/authority-store/rec" text tmpp "build/authority-store/tmp" text genp "build/authority-store/gen" global sb uchar 256 +global stail uchar 1 global spkt uchar 256 global sn ulong 1 global spath uchar 128 global splen ulong 1 +global sgerr ulong 1 fn put16 v ulong to void put spkt get sn 0 uchar and v 255 put spkt add get sn 0 1 uchar shr v 8 @@ -97,27 +100,39 @@ if lt fd 0 ret 20 end n = read int fd sb 0 256 +extra = long -1 +if eq n 256 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 ret 21 end -if ne n 256 +if or ne n 256 ne extra 0 ret 22 end dv = dec r ret 0 end fn readgen to ulong +put sgerr 0 0 setgen fd = fopen spath 0 get splen 0 0 0 if lt fd 0 -ret 30 +put sgerr 0 30 +ret 0 end n = read int fd sb 0 8 +extra = long -1 +if eq n 8 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 -ret 31 +put sgerr 0 31 +ret 0 end -if ne n 8 -ret 32 +if or ne n 8 ne extra 0 +put sgerr 0 32 +ret 0 end v = ulong 0 for j ulong 8 diff --git a/seed/authority/store.om b/seed/authority/store.om index 3a50b8c2b..c924cc389 100644 --- a/seed/authority/store.om +++ b/seed/authority/store.om @@ -7,6 +7,7 @@ text recp "build/authority-store/rec" text tmpp "build/authority-store/tmp" text genp "build/authority-store/gen" global sb uchar 256 +global stail uchar 1 global spkt uchar 256 global sn ulong 1 global spath uchar 128 @@ -99,10 +100,14 @@ if lt fd 0 ret 20 end n = read int fd sb 0 256 +extra = long -1 +if eq n 256 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 ret 21 end -if ne n 256 +if or ne n 256 ne extra 0 ret 22 end dv = dec r @@ -117,11 +122,15 @@ put sgerr 0 30 ret 0 end n = read int fd sb 0 8 +extra = long -1 +if eq n 8 +extra = read int fd stail 0 1 +end if ne fclose int fd 0 put sgerr 0 31 ret 0 end -if ne n 8 +if or ne n 8 ne extra 0 put sgerr 0 32 ret 0 end ```