Segmentation fault in when using gzread

Sebastian Sumpf Sebastian.Sumpf at ...1...
Fri Oct 31 07:13:31 CET 2014

Hi Johannes,

On 10/30/2014 08:01 PM, Johannes Schlatow wrote:
> Hey everyone,
> I'm using some 3rd party code that depends on zlib. In particular, it
> uses gzread() in order to read a file. Unfortunately, the
> corresponding piece of code causes a segfault in
> I narrowed this down to the following minimum example:
>   gzFile gzfile_components = gzopen("test.txt", "rb");
>   unsigned char buffer[1024*1024];
>   gzread(gzfile_components, buffer, sizeof(buffer));
> As you can see, the buffer is quite large but this the actual (and
> reasonable) value used in the 3rd party code.
> As soon as I reduce the size to e.g. 4096, the segfault is gone. 
> The file I used has a size of 293 bytes. I'm using base-linux.
> I also remember using this code successfully on a different computer
> with an older version of Genode (14.03).
> Any ideas/comments on this?

Are you using Genode's staging or master branch? I am asking because we
just switched to a new implementation on staging.
Nevertheless, in order to help I would need some way to reproduce your
error, for example a run script triggering the error or source code
would do, I cannot tell the problem from your code snippet above.



Sebastian Sumpf
Genode Labs ·

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth

More information about the users mailing list