| 1209 | } |
| 1210 | |
| 1211 | static cbm_coverage_parse_status_t cv2_arguments(const void *profiles, size_t profiles_len, |
| 1212 | const char *tests, size_t tests_len, |
| 1213 | const cbm_coverage_parse_limits_t *limits) { |
| 1214 | if (!profiles || (!tests && tests_len) || !limits) |
| 1215 | return CBM_COVERAGE_PARSE_INVALID; |
| 1216 | if (!limits->max_input_bytes || limits->max_input_bytes > UINT64_MAX / 8 || |
| 1217 | !limits->max_items || !limits->max_alloc_bytes || limits->max_ids <= 0) |
| 1218 | return CBM_COVERAGE_PARSE_INVALID; |
| 1219 | if (profiles_len > (size_t)PTRDIFF_MAX || tests_len > (size_t)PTRDIFF_MAX) |
| 1220 | return CBM_COVERAGE_PARSE_LIMIT; |
| 1221 | uint64_t total = (uint64_t)profiles_len; |
| 1222 | if ((uint64_t)tests_len > UINT64_MAX - total) |
| 1223 | return CBM_COVERAGE_PARSE_LIMIT; |
| 1224 | total += (uint64_t)tests_len; |
| 1225 | if (total > limits->max_input_bytes) |
| 1226 | return CBM_COVERAGE_PARSE_LIMIT; |
| 1227 | return CBM_COVERAGE_PARSE_OK; |
| 1228 | } |
| 1229 | |
| 1230 | cbm_coverage_parse_status_t cbm_coverage_map_parse_v2(const void *profiles, size_t profiles_len, |
| 1231 | const char *tests, size_t tests_len, |
no outgoing calls
no test coverage detected