Commit 13a0b2e5 authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Fixed case where a gridFTP client sends overlapping chunks. We now raise an...

Fixed case where a gridFTP client sends overlapping chunks. We now raise an error instead of screwing the checksum
parent cb081e97
......@@ -504,10 +504,26 @@ globus_l_gfs_file_net_read_cb(
for (i=1;i<CASTOR2int_handle->number_of_blocks;i++) {
/* check the continuity with previous chunk */
if (checksum_array[i]->offset != chkOffset) {
// not continuous, a chunk is missing, consider it full of 0s
globus_off_t doff = checksum_array[i]->offset - chkOffset;
file_checksum = adler32_combine_(file_checksum, adler32_0chunks(doff), doff);
chkOffset = checksum_array[i]->offset;
// not continuous, either a chunk is missing or we have overlapping chunks
if (checksum_array[i]->offset > chkOffset) {
// a chunk is missing, consider it full of 0s
globus_off_t doff = checksum_array[i]->offset - chkOffset;
file_checksum = adler32_combine_(file_checksum, adler32_0chunks(doff), doff);
chkOffset = checksum_array[i]->offset;
} else {
// overlapping chunks. This is not supported, fail the transfer
free_checksum_list(CASTOR2int_handle->checksum_list);
CASTOR2int_handle->cached_res = GLOBUS_FAILURE;
globus_gfs_log_message(GLOBUS_GFS_LOG_ERR,"%s: Overlapping chunks detected while handling 0x%x-0x%x. The overlap starts at 0x%x\n",
func,
checksum_array[i]->offset,
checksum_array[i]->offset+checksum_array[i]->size,
chkOffset);
CASTOR2int_handle->done = GLOBUS_TRUE;
close(CASTOR2int_handle->fd);
globus_mutex_unlock(&CASTOR2int_handle->mutex);
return;
}
}
/* now handle the next chunk */
file_checksum=adler32_combine_(file_checksum,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment