Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 653106 - net-libs/libtirpc-1.0.2-r1: Incorrect marshalling on 64-bit
Summary: net-libs/libtirpc-1.0.2-r1: Incorrect marshalling on 64-bit
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://bugzilla.redhat.com/show_bug....
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-04-13 16:53 UTC by Marcus Comstedt
Modified: 2019-07-10 04:17 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix for incorrect marshalling of "long" on 64-bit (long_io.patch,718 bytes, patch)
2018-04-13 16:53 UTC, Marcus Comstedt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Comstedt 2018-04-13 16:53:00 UTC
Created attachment 527280 [details, diff]
Fix for incorrect marshalling of "long" on 64-bit

In src/xdr_stdio.c in libtirpc, there are two functions to marshal integers.  The fread/fwrite calls use "sizeof(int32_t)" to specify how much to read or write (which is correct), however the data that is read/written is accessed using a "long *", which is not correct on LP64 systems where "long" is 64 bit, not 32.

This leads to weird behaviour being observed on 64-bit big endian, such as multi-gigabyte allocations being attempted.  Just running "id" prints memory allocation errors from xdr_string if I limit the memory space to 1 GB.

The attached patch fixes the issue by dereferencing the data as 32-bit and _then_ converting to long on read, and vice versa on write.
Comment 1 Matt Turner gentoo-dev 2019-07-10 04:17:29 UTC
Looks like this was fixed by http://git.linux-nfs.org/?p=steved/libtirpc.git;a=commit;h=145272c2b6d89a1c3a7de86a2cbef43880f1b61b which is in v1.1.4.