Bug 25685 - Stack overflow in ZipFile.OpenRead
Summary: Stack overflow in ZipFile.OpenRead
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: João Matos
URL:
Depends on:
Blocks:
 
Reported: 2015-01-02 12:32 UTC by ziparchivebug
Modified: 2015-03-09 16:43 UTC (History)
3 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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description ziparchivebug 2015-01-02 12:32:43 UTC
On running ZipFile.OpenRead I get an error message. It does not matter whether the file exists, does not exist, is a Zip file or not. Expected behavior is to throw an exception if the file does not exist or is not a Zip file, and to succeed if the file is a Zip file.

Example code:

public static void Main (string[] args)
{
	ZipFile.OpenRead ("anything");
}


Output:

Loaded assembly: /home/echo/ZipFileStackOverflow/ZipFileStackOverflow/bin/Debug/ZipFileStackOverflow.exe
Loaded assembly: /usr/lib/mono/gac/System.IO.Compression.FileSystem/4.0.0.0__b77a5c561934e089/System.IO.Compression.FileSystem.dll [External]
Loaded assembly: /usr/lib/mono/gac/System.IO.Compression/4.0.0.0__b77a5c561934e089/System.IO.Compression.dll [External]
Stack overflow: IP: 0x41a96344, fault addr: (nil)
Stacktrace:
  at System.IO.Compression.ZipFile.Open (string,System.IO.Compression.ZipArchiveMode) [0x00000] in /builddir/build/BUILD/mono-3.10.0/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs:138
  <...>
  at System.IO.Compression.ZipFile.OpenRead (string) [0x00000] in /builddir/build/BUILD/mono-3.10.0/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs:178
  at ZipFileStackOverflow.MainClass.Main (string[]) [0x00006] in /home/echo/ZipFileStackOverflow/ZipFileStackOverflow/Program.cs:10
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>


mono -V:

Mono JIT compiler version 3.10.0 (tarball Mon Nov 17 11:59:05 GMT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen

I am happy to provide any further information as necessary.
Comment 2 João Matos 2015-01-13 06:42:27 UTC
This should have already been fixed.

https://github.com/mono/mono/commit/649f91f71b096b883c3e0317a7dc7d0e1daf91dc
Comment 3 michael.bennett 2015-03-09 14:42:52 UTC
Is this fix in a current release?  I'm running 3.12.0 and I'm getting the StackOverflowException.

Mono JIT compiler version 3.12.0 (tarball Sat Feb  7 19:12:57 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
Comment 4 João Matos 2015-03-09 16:43:08 UTC
It seems the commit was not backported to the 3.12 branch, but you'll find on the upcoming 4.0 release.