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/blob/main/seed/qualification/security673/packet-corpus.om # 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 branch `main` Branches Tags History `omega-mv / seed / qualification / security673 / packet-corpus.om` 166 lines ยท 2748 bytes Raw Blame History 1 note Synthetic issue #671 packed-list corpus. Reads one mode byte and writes one packet to stdout. 2 note Format (OMEGESE, exec packed list): u16le count 1..1024, then count records of u16le length and 3 note bytes; whole packet at most 65536 bytes; first record nonempty; no zero byte; no trailing bytes. 4 note Accepted modes 0 8 11 12. Every other mode breaks exactly the rule named beside it and must 5 note be refused with trap 3 before any kernel exec. Unknown modes exit 92; I/O failures 90 and 91. 6 global pkt uchar 131072 7 global n ulong 1 8 text path "/bin/true" 9 text echo "/bin/echo" 10 text word1 "packed" 11 text word2 "list" 12 fn emitb v uchar to void 13 put pkt get n 0 v 14 put n 0 add get n 0 1 15 end 16 fn put16 v ulong to void 17 emitb uchar and v 255 18 emitb uchar shr v 8 19 end 20 fn pfill v uchar k ulong to void 21 for i ulong k 22 emitb v 23 end 24 end 25 fn rawtrue to void 26 for i ulong len path 27 emitb get path i 28 end 29 end 30 fn rectrue to void 31 put16 len path 32 rawtrue 33 end 34 fn rececho to void 35 put16 len echo 36 for i ulong len echo 37 emitb get echo i 38 end 39 put16 len word1 40 for i ulong len word1 41 emitb get word1 i 42 end 43 put16 len word2 44 for i ulong len word2 45 emitb get word2 i 46 end 47 end 48 fn modea m ulong to void 49 note 0 valid single record; 1 count 0; 2 count 1025 without records; 3 record declares 5, has 3. 50 if eq m 0 51 put16 1 52 rectrue 53 end 54 if eq m 1 55 put16 0 56 end 57 if eq m 2 58 put16 1025 59 end 60 if eq m 3 61 put16 1 62 put16 5 63 emitb 97 64 emitb 98 65 emitb 99 66 end 67 note 4 trailing byte; 5 empty first record; 6 zero byte inside the path. 68 if eq m 4 69 put16 1 70 rectrue 71 emitb 0 72 end 73 if eq m 5 74 put16 1 75 put16 0 76 end 77 if eq m 6 78 put16 1 79 put16 len path 80 for i ulong len path 81 if eq i 7 82 emitb 0 83 else 84 emitb get path i 85 end 86 end 87 end 88 note 7 record declares 4093 bytes and the 4096-byte packet holds 4092. 89 if eq m 7 90 put16 1 91 put16 4093 92 pfill 97 4092 93 end 94 end 95 fn modeb m ulong to void 96 note 8 valid 1024 records (path plus 1023 empty arguments); 9 count 1025 with 1025 well-formed records. 97 if eq m 8 98 put16 1024 99 rectrue 100 for i ulong 1023 101 put16 0 102 end 103 end 104 if eq m 9 105 put16 1025 106 rectrue 107 for i ulong 1024 108 put16 0 109 end 110 end 111 note 10 well-formed 65537-byte packet (one byte over); 11 well-formed 65536-byte packet. 112 if eq m 10 113 put16 2 114 rectrue 115 put16 65522 116 pfill 97 65522 117 end 118 if eq m 11 119 put16 2 120 rectrue 121 put16 65521 122 pfill 97 65521 123 end 124 note 12 valid echo packet; 13 zero byte after a valid path; 14 count 65535; 15 length 65535. 125 if eq m 12 126 put16 3 127 rececho 128 end 129 if eq m 13 130 put16 1 131 put16 11 132 rawtrue 133 emitb 0 134 emitb 120 135 end 136 if eq m 14 137 put16 65535 138 end 139 if eq m 15 140 put16 1 141 put16 65535 142 emitb 97 143 emitb 98 144 end 145 end 146 fn main to int 147 if ne read 0 pkt 0 1 1 148 ret 90 149 end 150 m = ulong get pkt 0 151 if gt m 15 152 ret 92 153 end 154 put n 0 0 155 modea m 156 modeb m 157 done = ulong 0 158 while lt done get n 0 bound 131073 159 r = write 1 pkt done sub get n 0 done 160 if le r 0 161 ret 91 162 end 163 done = add done ulong r 164 end 165 ret 0 166 end