php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56611 Extension fails to load dictionaries on 64bit systems
Submitted: 2005-10-24 07:20 UTC Modified: 2008-07-17 06:14 UTC
From: skettler@php.net Assigned: skettler (profile)
Status: Closed Package: crack (PECL)
PHP Version: 5_1 CVS-2005-10-24 (dev) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
30 - 5 = ?
Subscribe to this entry?

 
 [2005-10-24 07:20 UTC] skettler@php.net
Description:
------------
Tere is a 32/64 bit size problem on AMD 64 systems.

The version of cracklib bundled in the pecl package improperly defines the following types in libcrack/src/cracklib.h:47:

typedef unsigned char int8;
typedef unsigned short int int16;
typedef unsigned long int32;

This results in int32 being 64 bits on an x86-64 machine because longs are 8 bytes long.  I changed this to:

typedef unsigned char int8;
typedef unsigned short int int16;
typedef unsigned int int32;

So that int32 is now actually 32 bits long.

It looks like the upstream version of crack does not suffer from these problems; it contains the following, which would work as well:

typedef u_int8_t int8;
typedef u_int16_t int16;
typedef u_int32_t int32;

Which are defined in sys/types.h.

I came across this problem becuase the pecl version of crack could not read the magic number at the beginning of the dictionary that I had created with the Debian version of crack_mkdict (I kept on receiving "magic mismatch" errors).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-31 17:02 UTC] skettler@php.net
Fixed in current CVS, but additional cross-platform tests needed before releasing new version.
 [2006-08-04 14:38 UTC] gersonsm at gmail dot com
Must copy libcrack/src/packlib.c together.
 [2006-08-11 00:22 UTC] james at advmm dot com
Same issue experienced on Intel x86_64 system (running FC5).
Fixed as above by replacing:

typedef unsigned long int int32;

with:

typedef unsigned int int32;

in libcrack/src/cracklib.h, before installing extension (installed manually - '# pecl install crack' failed).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC