Opened 9 years ago

Closed 9 years ago

#685 closed defect (fixed)

32-bit xapian-replicate fails to copy files larger than 4GB

Reported by: Josh Elsasser Owned by: Olly Betts
Priority: normal Milestone: 1.2.22
Component: Replication Version: 1.2.15
Severity: normal Keywords: patch
Cc: Blocked By:
Blocking: Operating System: Linux

Description

A 32-bit xapian-replicate binary will fail to receiving a file larger than 4GB. The cause is in RemoteConnection::receive_file(), where the message length is decoded into a size_t variable. A size_t is unsuitable for holding a file size, and the server side correctly uses an off_t when encoding the size.

I have not tried a newer version of xapian however the relevant code appears unchanged on git master. The attached diff is against 1.2.15 however it looks like it would apply to master with little effort.

Attachments (1)

xapian-replicate-use-off-t-for-size.patch (1.3 KB ) - added by Josh Elsasser 9 years ago.
Use off_t for file size when receiving files via replication protocol.

Download all attachments as: .zip

Change History (5)

by Josh Elsasser, 9 years ago

Use off_t for file size when receiving files via replication protocol.

comment:1 by Olly Betts, 9 years ago

Keywords: patch added
Milestone: 1.3.4
Owner: set to Olly Betts
Status: newassigned

Thanks. Marking for 1.3.4 (then it can be backported).

comment:2 by Olly Betts, 9 years ago

Hmm, off_t is signed, and left shifts on signed values which "overflow" result in undefined behaviour, so I think we need to do a bit more than just change over the types. Will work up a fix.

comment:3 by Olly Betts, 9 years ago

Milestone: 1.3.41.2.22

OK, fixed in git master [b9bb02d2a36e961029cd68de103c40da6f2cf89d/git]. We should backport this for 1.2.22 (the previous refactoring commit [eb3ba36ed5b00d99842abd465a440ffc5038069e/git] is probably needed too).

comment:4 by Olly Betts, 9 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.