(path, maximum=64 * 1024 * 1024)
| 16 | |
| 17 | |
| 18 | def read(path, maximum=64 * 1024 * 1024): |
| 19 | path = Path(path) |
| 20 | require(not path.is_symlink() and path.is_file(), "missing/unsafe evidence file: " + str(path)) |
| 21 | with path.open("rb") as stream: |
| 22 | data = stream.read(maximum + 1) |
| 23 | require(len(data) <= maximum, "evidence file exceeds test bound") |
| 24 | return data |
| 25 | |
| 26 | |
| 27 | def json_read(path): |