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
omega-mv / seed / qualification / security673 / hostile-corpus.om
| 1 | note Synthetic source ingress campaign. Binary stdin is mode plus little-endian u32 count, no tail. |
| 2 | note Output is source only. This generator grants no execution authority and uses no private data. |
| 3 | global args uchar 5 |
| 4 | global extra uchar 1 |
| 5 | global buf uchar 4096 |
| 6 | global nums uchar 32 |
| 7 | text mainpre "fn main to int\n" |
| 8 | text done "ret 0\nend\n" |
| 9 | text numpre "fn main to int\nx = ulong " |
| 10 | text numend "\nret 0\nend\n" |
| 11 | text exprpre "fn main to int\nx = int 0\nif " |
| 12 | text addword "not " |
| 13 | text exprend "eq x 0\nret 0\nelse\nret 1\nend\nend\n" |
| 14 | text ifword "if true\n" |
| 15 | text endword "end\n" |
| 16 | text textpre "text data \"" |
| 17 | text textend "\"\nfn main to int\nret 0\nend\n" |
| 18 | note Function names are g<n>: f32 and f64 are type keywords, so f<n> made the count fixture fail on f32. |
| 19 | text fnpre "fn g" |
| 20 | text fnpost " to int\nret 0\nend\n" |
| 21 | text array "global data uchar 16777217\nfn main to int\nret 0\nend\n" |
| 22 | text quote "text data \"abc" |
| 23 | text unknown "fn main to int\nret unknown\nend\n" |
| 24 | note Float literals of n zero digits (#965): fraction (underflows to 0.0), exponent (1.5e0..01 is 15), and an |
| 25 | note untyped literal whose type comes from the other operand (deferred span; 2.0 + 0..01.5 truncates to 3). |
| 26 | text fracpre "fn main to int\nx = f64 0." |
| 27 | text fracend "1f64\nif eq x 0.0f64\nret 0\nend\nret 1\nend\n" |
| 28 | text exppre "fn main to int\nx = f64 1.5e" |
| 29 | text expend "1f64\nret int x\nend\n" |
| 30 | text defpre "fn main to int\nx = f64 2.0\ny = add " |
| 31 | text defend "1.5 x\nret int y\nend\n" |
| 32 | fn fill b uchar count ulong to void |
| 33 | for i ulong len buf |
| 34 | put buf i b |
| 35 | end |
| 36 | n = count |
| 37 | while ne n 0 |
| 38 | chunk = n |
| 39 | if gt chunk len buf |
| 40 | chunk = len buf |
| 41 | end |
| 42 | if ne write 1 buf 0 chunk long chunk |
| 43 | exit 91 |
| 44 | end |
| 45 | n = sub n chunk |
| 46 | end |
| 47 | end |
| 48 | fn putnum v ulong to void |
| 49 | x = v |
| 50 | n = ulong 0 |
| 51 | while ge x 10 |
| 52 | put nums n uchar add 48 rem x 10 |
| 53 | x = div x 10 |
| 54 | n = add n 1 |
| 55 | end |
| 56 | put nums n uchar add 48 x |
| 57 | n = add n 1 |
| 58 | for i ulong n |
| 59 | if ne write 1 nums sub sub n i 1 1 1 |
| 60 | exit 91 |
| 61 | end |
| 62 | end |
| 63 | end |
| 64 | fn numeric n ulong to void |
| 65 | if ne write 1 numpre 0 len numpre long len numpre |
| 66 | exit 91 |
| 67 | end |
| 68 | fill 48 n |
| 69 | if ne write 1 numend 0 len numend long len numend |
| 70 | exit 91 |
| 71 | end |
| 72 | end |
| 73 | fn nested n ulong to void |
| 74 | if ne write 1 exprpre 0 len exprpre long len exprpre |
| 75 | exit 91 |
| 76 | end |
| 77 | for i ulong n |
| 78 | if ne write 1 addword 0 len addword long len addword |
| 79 | exit 91 |
| 80 | end |
| 81 | end |
| 82 | if ne write 1 exprend 0 len exprend long len exprend |
| 83 | exit 91 |
| 84 | end |
| 85 | end |
| 86 | fn blocks n ulong to void |
| 87 | if ne write 1 mainpre 0 len mainpre long len mainpre |
| 88 | exit 91 |
| 89 | end |
| 90 | for i ulong n |
| 91 | if ne write 1 ifword 0 len ifword long len ifword |
| 92 | exit 91 |
| 93 | end |
| 94 | end |
| 95 | for i ulong n |
| 96 | if ne write 1 endword 0 len endword long len endword |
| 97 | exit 91 |
| 98 | end |
| 99 | end |
| 100 | if ne write 1 done 0 len done long len done |
| 101 | exit 91 |
| 102 | end |
| 103 | end |
| 104 | fn literal n ulong to void |
| 105 | if ne write 1 textpre 0 len textpre long len textpre |
| 106 | exit 91 |
| 107 | end |
| 108 | fill 97 n |
| 109 | if ne write 1 textend 0 len textend long len textend |
| 110 | exit 91 |
| 111 | end |
| 112 | end |
| 113 | fn funcs n ulong to void |
| 114 | for i ulong n |
| 115 | if ne write 1 fnpre 0 len fnpre long len fnpre |
| 116 | exit 91 |
| 117 | end |
| 118 | putnum i |
| 119 | if ne write 1 fnpost 0 len fnpost long len fnpost |
| 120 | exit 91 |
| 121 | end |
| 122 | end |
| 123 | if ne write 1 mainpre 0 len mainpre long len mainpre |
| 124 | exit 91 |
| 125 | end |
| 126 | if ne write 1 done 0 len done long len done |
| 127 | exit 91 |
| 128 | end |
| 129 | end |
| 130 | fn floats m uchar n ulong to void |
| 131 | if eq m 11 |
| 132 | if ne write 1 fracpre 0 len fracpre long len fracpre |
| 133 | exit 91 |
| 134 | end |
| 135 | fill 48 n |
| 136 | if ne write 1 fracend 0 len fracend long len fracend |
| 137 | exit 91 |
| 138 | end |
| 139 | end |
| 140 | if eq m 12 |
| 141 | if ne write 1 exppre 0 len exppre long len exppre |
| 142 | exit 91 |
| 143 | end |
| 144 | fill 48 n |
| 145 | if ne write 1 expend 0 len expend long len expend |
| 146 | exit 91 |
| 147 | end |
| 148 | end |
| 149 | if eq m 13 |
| 150 | if ne write 1 defpre 0 len defpre long len defpre |
| 151 | exit 91 |
| 152 | end |
| 153 | fill 48 n |
| 154 | if ne write 1 defend 0 len defend long len defend |
| 155 | exit 91 |
| 156 | end |
| 157 | end |
| 158 | end |
| 159 | fn main to int |
| 160 | p = ulong 0 |
| 161 | while lt p 5 |
| 162 | r = read 0 args p sub 5 p |
| 163 | if le r 0 |
| 164 | ret 90 |
| 165 | end |
| 166 | p = add p ulong r |
| 167 | end |
| 168 | if ne read 0 extra 0 1 0 |
| 169 | ret 90 |
| 170 | end |
| 171 | m = get args 0 |
| 172 | if gt m 13 |
| 173 | ret 90 |
| 174 | end |
| 175 | n = ulong 0 |
| 176 | for i ulong 4 |
| 177 | n = or n shl ulong get args add i 1 mul i 8 |
| 178 | end |
| 179 | if gt n 8388608 |
| 180 | ret 90 |
| 181 | end |
| 182 | if eq m 0 |
| 183 | numeric n |
| 184 | end |
| 185 | if eq m 1 |
| 186 | if gt n 2048 |
| 187 | ret 90 |
| 188 | end |
| 189 | nested n |
| 190 | end |
| 191 | if eq m 2 |
| 192 | if gt n 1024 |
| 193 | ret 90 |
| 194 | end |
| 195 | blocks n |
| 196 | end |
| 197 | if eq m 3 |
| 198 | literal n |
| 199 | end |
| 200 | if eq m 4 |
| 201 | if gt n 4096 |
| 202 | ret 90 |
| 203 | end |
| 204 | funcs n |
| 205 | end |
| 206 | if eq m 5 |
| 207 | fill 0 1 |
| 208 | end |
| 209 | if eq m 6 |
| 210 | if ne write 1 array 0 len array long len array |
| 211 | ret 91 |
| 212 | end |
| 213 | end |
| 214 | if eq m 7 |
| 215 | if ne write 1 quote 0 len quote long len quote |
| 216 | ret 91 |
| 217 | end |
| 218 | end |
| 219 | if eq m 8 |
| 220 | if ne write 1 unknown 0 len unknown long len unknown |
| 221 | ret 91 |
| 222 | end |
| 223 | end |
| 224 | if and ge m 9 le m 10 |
| 225 | fill 32 n |
| 226 | if ne write 1 mainpre 0 len mainpre long len mainpre |
| 227 | ret 91 |
| 228 | end |
| 229 | if ne write 1 done 0 len done long len done |
| 230 | ret 91 |
| 231 | end |
| 232 | end |
| 233 | if ge m 11 |
| 234 | floats m n |
| 235 | end |
| 236 | ret 0 |
| 237 | end |