interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / qualification / security673 / path-consumer.om

67 lines · 927 bytes Raw Blame History
1note Synthetic issue671 path and argread boundary consumer. Mode byte on stdin.
2note Modes0-3 exercise fopen; modes4-6 exercise argread with the first argument.
3global mode uchar 1
4global buf uchar 4096
5text ok "build/security673-native/path-ok"
6text data "x"
7fn main to int
8if ne read 0 mode 0 1 1
9ret 90
10end
11m = ulong get mode 0
12if eq m 0
13fd = fopen ok 0 len ok 577 384
14if lt fd 0
15ret 91
16end
17r = write int fd data 0 1
18if ne r 1
19ret 92
20end
21if ne fclose int fd 0
22ret 93
23end
24ret 0
25end
26if eq m 1
27for i ulong len ok
28put buf i get ok i
29end
30put buf 5 0
31r = fopen buf 0 len ok 0 0
32ret 94
33end
34if eq m 2
35for i ulong 4096
36put buf i 97
37end
38r = fopen buf 0 4096 0 0
39ret 95
40end
41if eq m 3
42r = fopen buf 0 0 0 0
43if lt r 0
44ret 0
45end
46ret 96
47end
48if eq m 4
49n = argread 1 buf 0 1
50if ne n neg long 105
51ret 97
52end
53ret 0
54end
55if eq m 5
56n = argread 99 buf 0 4
57ret 98
58end
59if eq m 6
60n = argread 1 buf 0 len buf
61if le n 0
62ret 99
63end
64ret 0
65end
66ret 98
67end