Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Dec 2008 19:05:27 GMT
From:      Paul Wessel <pwessel@hawaii.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/129599: Possible 64-bit bug in qsort
Message-ID:  <200812121905.mBCJ5Rh1013057@www.freebsd.org>
Resent-Message-ID: <200812121910.mBCJA1gX068250@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         129599
>Category:       misc
>Synopsis:       Possible 64-bit bug in qsort
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 12 19:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Paul Wessel
>Release:        Actually using OSX but bug is in FreeBSD too
>Organization:
GG/SOEST/UH
>Environment:
Darwin macnut 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep  3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386


>Description:
Darwin and I believe FreeBSD has a qsort which fails in 64-bit mode for large > 3.5Gb data.
>How-To-Repeat:
Try to sort any large array (say 4 Gb) in 64-bit mode using qsort.  If it fails then FreeBSD also has this bug that Leopard has.
>Fix:
Two key internal variables in qsort (r and d) need to be long and not int.  That is easy to check.  Also, a swapfunc (if used) needs its 3rd argument to be size_t.  With those changes the function works.



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812121905.mBCJ5Rh1013057>