Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
All
-
3
-
16910
Description
Original text/report from J.Nemeth (SGI) :
The ct_copy_data() routine has the following code: rc = lseek(src_fd, hai->hai_extent.offset, SEEK_SET); if (rc < 0) { CT_ERROR(errno, "cannot seek for read to "LPU64" (len %jd) in '%s'", hai->hai_extent.offset, (intmax_t)src_st.st_size, src); rc = -errno; goto out; } This appears to be checking to ensure that the hai_extent.offset value is not outside the bounds of the file. However, this call will never fail, because it is not illegal to seek outside the bounds of the file: an attempt to write at an offset beyond the file bounds will extend the file (potentially leaving a "hole" in the data), and an attempt to read at that location will cause an EOD error. But the lseek() won't fail. This occurs after fstat() has already been called on the open src file, so the file size is already known. This should simply check the offset against the file size. Similarly, the following occurs shortly afterward: length = min(hai->hai_extent.length, src_st.st_size); This seems simply wrong -- it should be: length = min(hai->hai_extent.length, src_st.st_size - hai->hai_extent.offset); I don't know if the coordinator ever issues a request for part of a source file, but these error checks are wrong, and should be removed, or corrected.
Attachments
Issue Links
- mentioned in
-
Page Loading...