Netflix / vmaf

Perceptual video quality assessment based on multi-method fusion.
Other
4.65k stars 755 forks source link

Segfault on some invalid inputs #1351

Closed nilfm99 closed 7 months ago

nilfm99 commented 8 months ago

If the user passes in a YUV or Y4M that specifies bitdepth=10 but actually has pixel values greater than 1023 (which is possible to represent in the YUV format, just invalid), we don't have any validation against that. As a result, we can either get nonsensical results from most features, or even get a segfault from CAMBI since it uses the pixel values to index an array of histograms.

Ideally we should validate inputs, but it is computationally expensive to check every pixel. In a quick benchmark, I saw an ~8% performance degradation by checking all the pixels inside validate_pic_params in libvmaf.c. Alternatively, we could sample a few pixels as a heuristic.

nilfm99 commented 8 months ago

Note that it is impossible to validate this with 100% confidence, since a 12-bit YUV could have low values throughout and be a valid 10-bit YUV, with no way of telling them apart.