[Pkg-scicomp-devel] Bug#523076: Undefined behaviour causing problems on AVR32

Bradley Smith bradsmith at debian.org
Wed Apr 8 10:12:36 UTC 2009


Package: gmp
Version: 2:4.2.4+dfsg-2
Severity: wishlist

In scanf/sscanffuns.c, the function 'scan' is defined as:

 static int scan (const char **sp, const char *fmt, void *p1, void *p2)

but is then casted to:

 int (*gmp_doscan_scan_t)  _PROTO ((void *, const char *, ...))

and used. Whilst most architectures seem to cope with this, it is
undefined behaviour and due to the way varargs are implemented on AVR32,
it causes segfaults/incorrect results.

I have attached a simple fix for this which simply changes 'scan' to use
varargs as in the gmp_doscan_scan_t prototype.

I have filed this as wishlist simply because AVR32 is not an official arch
yet, but rather just work in progress, but it otherwise would be serious
as it FTBFS because of it.

Note, I've also just sent this upstream.

Regards,
Bradley Smith

-- 
Bradley Smith                                     brad at brad-smith.co.uk
Debian GNU/Linux Developer                         bradsmith at debian.org
GPG: 0xC718D347       D201 7274 2FE1 A92A C45C EFAB 8F70 629A C718 D347
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gmp-4.2.4-fix-undefined-behaviour.diff.txt
URL: <http://lists.alioth.debian.org/pipermail/pkg-scicomp-devel/attachments/20090408/2cd9149f/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-scicomp-devel/attachments/20090408/2cd9149f/attachment.pgp>


More information about the Pkg-scicomp-devel mailing list