Bug 361 - minizip as used by System.IO.Packaging is not 64bit safe
Summary: minizip as used by System.IO.Packaging is not 64bit safe
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WindowsBase (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-08-22 12:18 UTC by Alan McGovern
Modified: 2014-02-12 17:25 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 361 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Alan McGovern 2011-08-22 12:18:29 UTC
The minizip API exposes 'long' and 'ulong' types which are not fixed width. Therefore it's impossible to bind and P/Invoke these in a cross platform way. Currently we only work on systems where sizeof (IntPtr) == sizeof (native long).

First: Should we fix this?
    - Yes, ideally we should. If we don't fix it, maybe there should be a compile time make check to ensure sizeof (native long) == sizeof (native pointer).
 
Second: How should we fix it
    - We can expose a nicer API which uses fixed width types.
    - Or we can modify the existing minizip APIs to expose only fixed width sizes

The former is the least invasive but would make it confusing for people P/Invoking the native libs as there'd be two sets of APIs to choose from.

The latter would be better as there'd be a single set of working APIs which can be P/Invoked. However if we wanted to import a newer minizip we'd have a maintenance burden porting the changes to the newer minizip. Also we'd have to port every single usage of minizip in one go if we wanted to go with this approach. If it's P/Invoked elsewhere it'd just blow up as the existing P/Invoke declarations would no longer be compatible.
Comment 1 Miguel de Icaza [MSFT] 2014-02-12 17:25:23 UTC
I suggest that we force uLong (the only long I could find on the API) to be 32bits on 64 bit systems.

It seems that the code in minizip assumes that uLong is actually 32 bits in a few places.