Bug 23168 - xdr_long and xdr_u_long should fail to encode when value is out of representable range
xdr_long and xdr_u_long should fail to encode when value is out of representa...
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.0
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-01-02 13:59 EST by John Kohl
Modified: 2016-11-24 10:06 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-01-02 14:01:39 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test program to show failure of xdr_u_long() on oversized value (2.70 KB, text/plain)
2001-01-02 14:00 EST, John Kohl
no flags Details

  None (edit)
Description John Kohl 2001-01-02 13:59:05 EST
xdr_long and xdr_u_long should fail to encode values which
will not fit in 32-bit quantities.
They succeed currently (in glibc-2.2) but only encode the low-order
32 bits.

See the examples in the attached program.
(earlier versions of glibc, before 2.2, screwed up xdr_u_long on decode,
sign extending rather than zero-extending)
Comment 1 John Kohl 2001-01-02 14:00:02 EST
Created attachment 6963 [details]
test program to show failure of xdr_u_long() on oversized value
Comment 2 John Kohl 2001-01-02 14:01:35 EST
bug is likely present on all platforms where
'long' is a 64-bit integral type
Comment 3 Jakub Jelinek 2001-01-04 05:04:12 EST
Thorsten Kukuk claims glibc is correct in doing so, see
http://sources.redhat.com/ml/libc-hacker/2001-01/msg00008.html
Comment 4 John Kohl 2001-01-04 09:02:59 EST
I disagree with your characterization of this as not a bug.

DEC OSF/1 -> Digital UNIX -> Tru64 UNIX has always done this range
checking since 1993.  It provides a very useful and important program
portability check.

For sensible interoperability between platforms with 32- and 64-bit
'long' values, these routines should fail to encode 64-bit longs.

It is absolutely broken for the routines to decode an encoded value into
something other than what was encoded.  Since the types cannot possibly
fit into the range of a 32-bit value on the wire, the routines *must*
fail on encoding.


Note You need to log in before you can comment on or make changes to this bug.