| 831 | } |
| 832 | |
| 833 | static bool gic_parse_oom(cbm_ignore_parse_fault_t fault, cbm_ignore_checked_usage_t *before, |
| 834 | cbm_ignore_checked_usage_t *usage) { |
| 835 | cbm_ignore_checked_t *owner = NULL; |
| 836 | cbm_ignore_checked_limits_t limits = gic_limits(); |
| 837 | if (!gic_open(&owner, &limits)) |
| 838 | return false; |
| 839 | const cbm_ignore_program_t *old_program = NULL; |
| 840 | if (!gic_parse(owner, "keep", 4, 1, &old_program) || !cbm_ignore_checked_usage(owner, before)) { |
| 841 | cbm_ignore_checked_free(owner); |
| 842 | return false; |
| 843 | } |
| 844 | cbm_ignore_checked_control_t control = gic_control(); |
| 845 | cbm_ignore_checked_error_t error; |
| 846 | cbm_ignore_checked_parse_result_t out = {.program = old_program, .pattern_count = 77}; |
| 847 | const char input[] = "one\ntwo\n"; |
| 848 | cbm_ignore_checked_status_t status = cbm_ignore_checked_parse_fault_for_tests( |
| 849 | owner, input, sizeof(input) - 1, &control, fault, &out, &error); |
| 850 | bool ok = gic_status(status, CBM_IGNORE_CHECKED_OOM, &error) && !out.program && |
| 851 | out.pattern_count == 0 && cbm_ignore_checked_usage(owner, usage) && |
| 852 | usage->bytes_reserved == before->bytes_reserved + sizeof(input) - 1 && |
| 853 | usage->patterns_reserved == before->patterns_reserved + 2 && |
| 854 | usage->arena_requested_bytes > before->arena_requested_bytes && |
| 855 | usage->terminal_status == CBM_IGNORE_CHECKED_OOM && |
| 856 | gic_terminal(owner, old_program, CBM_IGNORE_CHECKED_OOM); |
| 857 | cbm_ignore_checked_free(owner); |
| 858 | return ok; |
| 859 | } |
| 860 | |
| 861 | static bool gic_unreached_and_invalid_faults(cbm_ignore_checked_t *owner, |
| 862 | const cbm_ignore_program_t *program) { |
no test coverage detected