sekrit-twc / zimg

Scaling, colorspace conversion, and dithering library
Do What The F*ck You Want To Public License
405 stars 77 forks source link

Segfault when using error_diffusion #183

Closed Frechdachs closed 2 years ago

Frechdachs commented 2 years ago

OS: Linux CPU: 5800X

The following vapoursynth script results in a segfault:

import vapoursynth as vs

clip = vs.core.std.BlankClip(format=vs.YUV420P16)
clip = clip.resize.Point(format=vs.YUV420P8, dither_type="error_diffusion")
clip.set_output()
$ vspipe script.vpy .
Segmentation fault (core dumped)

Interestingly, it works fine when doing 444P16 --> 420P8 instead of 420P16 --> 420P8. 444P16 --> 444P8 gives a different error:

$ vspipe script2.vpy .
Fatal glibc error: malloc assertion failure in sysmalloc: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)

The current release 3.0.4 works fine in all cases.