Bounds checks for read_file, string_head and string_tail

These functions don't have bounds checks for negative values, and can fail hard when they encounter such values. This PR ensures that they can't be called with negative values for the respective size fields.