enumerator value overflows in pidl generated code
Nicholas Brealey
nick at brealey.org
Sun Mar 25 11:42:42 GMT 2007
Building Samba 3.0.25 pre 2 on Solaris 10 x86 with the Sun Studio 11
compilers and the following configure line:
CPPFLAGS=-I/usr/sfw/include LDFLAGS="-L/usr/sfw/lib -R/usr/sfw/lib"
CC=cc CFLAGS=-O ./configure --prefix=/opt/samba --with-automount
--with-quotas --with-sys-quotas --with-pam --with-acl-support
--with-included-popt --localstatedir=/var/samba
--with-logfilebase=/var/samba/log --with-piddir=/var/run
--with-privatedir=/etc/samba/private --with-configdir=/etc/samba
gives 1968 warning messages like:
"./librpc/gen_ndr/srvsvc.h", line 223: warning: enumerator value
overflows INT_MAX (2147483647)
from
#define STYPE_HIDDEN ( 0x80000000 )
...
enum srvsvc_ShareType {
...
STYPE_DISKTREE_HIDDEN=STYPE_DISKTREE|STYPE_HIDDEN,
...
STYPE_PRINTQ_HIDDEN=STYPE_PRINTQ|STYPE_HIDDEN,
...
STYPE_DEVICE_HIDDEN=STYPE_DEVICE|STYPE_HIDDEN,
...
STYPE_IPC_HIDDEN=STYPE_IPC|STYPE_HIDDEN
};
These messages can be eliminated with the attached patch which defines:
#define STYPE_HIDDEN ( (int32_t) 0x80000000 )
but it would be better to update pidl so that it produced standard
conforming C.
I think the issue is that enum values must be representable by an int
and 0x80000000 is not representable by an int.
The warnings could be suppressed using the following configure line but
this could hide more serious problems:
CPPFLAGS=-I/usr/sfw/include LDFLAGS="-L/usr/sfw/lib -R/usr/sfw/lib"
CC=cc CFLAGS="-errtags=yes -erroff=E_ENUM_VAL_OVERFLOWS_INT_MAX -O"
./configure --prefix=/opt/samba --with-automount --with-quotas
--with-sys-quotas --with-pam --with-acl-support --with-included-popt
--localstatedir=/var/samba --with-logfilebase=/var/samba/log
--with-piddir=/var/run --with-privatedir=/etc/samba/private
--with-configdir=/etc/samba
There is a related issue which occurs 8 times which I have not addressed:
"libmsrpc/cac_lsarpc.c", line 1161: warning: argument #8 is incompatible
with prototype:
prototype: pointer to pointer to unsigned int :
"include/proto.h", line 4863
argument : pointer to pointer to enum lsa_SidType
{SID_NAME_COMPUTER(9), SID_NAME_UNKNOWN(8), SID_NAME_INVALID(7),
SID_NAME_DELETED(6), SID_NAME_WKN_GRP(5), SID_NAME_ALIAS(4),
SID_NAME_DOMAIN(3), SID_NAME_DOM_GRP(2), SID_NAME_USER(1),
SID_NAME_USE_NONE(0)} (E_ARG_INCOMPATIBLE_WITH_ARG)
Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pidl_enum.patch
Type: text/x-patch
Size: 414 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20070325/cd67ee62/pidl_enum.bin
More information about the samba-technical
mailing list