Encode to chroma-subsampled JPEG fails with RGB data

Encoding RGB data with nvjpegEncodeImage fails with NVJPEG_STATUS_EXECUTION_FAILED when encoding to a chroma-subsampled format with specific image sizes, with a pitch that is equal to the width. An example of this is encoding a 101 by 101 image to NVJPEG_CSS_410.

It seems to work fine when using a pitch that is a multiple of, say, eight, but I cannot find such a requirement in the documentation.

I have published a minimal reproducer at GitHub - nolmoonen/nvjpeg-bug-report.

This was tested with CUDA 12.2, driver version 535.113.01, on Ubuntu 22.04.02.

Edit: I have filed a bug report (https://developer.nvidia.com/bugs/4363416).