AkarinVS / L-SMASH-Works

Works based on L-SMASH project; This repo focuses on the common portion and the VapourSynth plugin. AviSynth users please use https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works. ffmpeg 5.0+ please use ffmpeg-4.5 branch.
47 stars 11 forks source link

Error when accessing the frame props of alpha clip #16

Closed YomikoR closed 2 years ago

YomikoR commented 2 years ago

Suppose alpha.png has an alpha channel (e.g. created from Windows screenshot).

# Python 3.9.7 embedded
import vapoursynth as vs # R56 portable
clip = vs.core.lsmas.LWLibavSource('alpha.png') # vA.3g
frame = clip.get_frame(0)
print(frame.props) # Has an alpha frame
print(frame.props['_Alpha'].props) # Python crashes

The PNG: alpha

AkarinVS commented 2 years ago

Thanks for the bug report. Will update vA.3g builds soon.

YomikoR commented 2 years ago

Thanks. But having python crashed because of it still looks weird. Do you think it's a bug of VS?

AkarinVS commented 2 years ago

Not a bug of VS. It's a typo in lsmas that accidentally used propSetFrame (instead of propSetInt) to set the _ColorRange property to 0, which is interpreted as a NULL pointer. therefore when VS tries to create the Python props dict, it will try to create a VideoFrame from a NULL pointer, triggering a crash.