Can't get data for empty compressed resources
If you have a resource file that is empty (for example /org/gnome/gitg/ui/style-unix.css
in gitg) which is marked for compression, then it expands from 0 to 16 bytes, but the target size is still recorded (0 bytes). This is then passed into g_converter_convert() with the zlib decompressor.
However, this then runs into this assert in g_converter_convert():
g_return_val_if_fail (outbuf_size > 0, G_CONVERTER_ERROR);
Which fails the entire op.
I'm not sure what parts are wrong or not here. But here are some ideas:
- Don't auto-compress zero sized (or generally any files where the compressed data ends up larger).
- Skip decompression for zero sized targets
- Pass an extra byte for target buffer size
- Make the assert be >= 0 and make sure all decoders properly handle target size checks that are 0 bytes (which might be hard).
Edited by Alexander Larsson