misc/129599: Possible 64-bit bug in qsort

Paul Wessel pwessel at hawaii.edu
Fri Dec 12 11:10:01 PST 2008


>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:


More information about the freebsd-bugs mailing list