Read a varint that will be used as a size_t. Rejects negative values * (which would wrap to ~SIZE_MAX) and values exceeding the supplied max. */
| 1915 | /* Read a varint that will be used as a size_t. Rejects negative values |
| 1916 | * (which would wrap to ~SIZE_MAX) and values exceeding the supplied max. */ |
| 1917 | size_t read_varint_size(int f, size_t max, const char *what) |
| 1918 | { |
| 1919 | int32 v = read_varint(f); |
| 1920 | if (v < 0 || (size_t)v > max) { |
| 1921 | rprintf(FERROR, "wire size %s out of range: %ld > %lu [%s]\n", |
| 1922 | what, (long)v, (unsigned long)max, who_am_i()); |
| 1923 | exit_cleanup(RERR_PROTOCOL); |
| 1924 | } |
| 1925 | return (size_t)v; |
| 1926 | } |
| 1927 | |
| 1928 | int64 read_longint(int f) |
| 1929 | { |
no test coverage detected