Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert() fails with RGBA encode in master, 1.5.1 and 1.5.0 #151

Closed
jcupitt opened this issue Sep 1, 2019 · 2 comments
Closed

assert() fails with RGBA encode in master, 1.5.1 and 1.5.0 #151

jcupitt opened this issue Sep 1, 2019 · 2 comments

Comments

@jcupitt
Copy link

jcupitt commented Sep 1, 2019

Hello, thanks again for this nice thing.

With this test PNG:

tree

I see:

$ heif-enc tree.png -o tree.heif
heif-enc: malloc.c:2392: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.  
Aborted (core dumped)

With git master (as of 1 sep 2019), tag v1.5.1 and tag v1.5.0.

Tag v1.4.1 seems to work fine.

@jcupitt
Copy link
Author

jcupitt commented Sep 1, 2019

This is on Ubuntu 19.04, I should have said.

valgrind reports a bad write causing heap corruption:

$ valgrind heif-enc tree.png -o tree.heif
==25867== Memcheck, a memory error detector
==25867== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25867== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==25867== Command: heif-enc tree.png -o tree.heif
==25867== 
==25867== Invalid write of size 8
==25867==    at 0x483F913: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==25867==    by 0x48D91F6: heif::HeifPixelImage::copy_new_plane_from(std::shared_ptr<heif::HeifPixelImage const> const&, heif_channel, heif_channel) (heif_image.cc:308)
==25867==    by 0x48F41D7: create_alpha_image_from_image_alpha_channel(std::shared_ptr<heif::HeifPixelImage>) (heif_context.cc:1508)
==25867==    by 0x48F4C22: heif::HeifContext::Image::encode_image_as_hevc(std::shared_ptr<heif::HeifPixelImage>, heif_encoder*, heif_encoding_options const*, heif_image_input_class) (heif_context.cc:1694)
==25867==    by 0x48F4846: heif::HeifContext::encode_image(std::shared_ptr<heif::HeifPixelImage>, heif_encoder*, heif_encoding_options const*, heif_image_input_class, std::shared_ptr<heif::HeifContext::Image>&) (heif_context.cc:1631)
==25867==    by 0x48E6474: heif_context_encode_image (heif.cc:1739)
==25867==    by 0x10F818: main (heif_enc.cc:1077)
==25867==  Address 0x6160298 is 71,816 bytes inside a block of size 71,823 alloc'd
==25867==    at 0x48394DF: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==25867==    by 0x48D8A6F: heif::HeifPixelImage::add_plane(heif_channel, int, int, int) (heif_image.cc:151)
==25867==    by 0x48D9142: heif::HeifPixelImage::copy_new_plane_from(std::shared_ptr<heif::HeifPixelImage const> const&, heif_channel, heif_channel) (heif_image.cc:294)
==25867==    by 0x48F41D7: create_alpha_image_from_image_alpha_channel(std::shared_ptr<heif::HeifPixelImage>) (heif_context.cc:1508)
==25867==    by 0x48F4C22: heif::HeifContext::Image::encode_image_as_hevc(std::shared_ptr<heif::HeifPixelImage>, heif_encoder*, heif_encoding_options const*, heif_image_input_class) (heif_context.cc:1694)
==25867==    by 0x48F4846: heif::HeifContext::encode_image(std::shared_ptr<heif::HeifPixelImage>, heif_encoder*, heif_encoding_options const*, heif_image_input_class, std::shared_ptr<heif::HeifContext::Image>&) (heif_context.cc:1631)
==25867==    by 0x48E6474: heif_context_encode_image (heif.cc:1739)
==25867==    by 0x10F818: main (heif_enc.cc:1077)
==25867== 

@fancycode
Copy link
Member

Fixed in latest master, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants