Easy to reproduce:
Take jpegNPP program from cuda v5.5 samples, try to run it on a jpeg file which is larger than 1 MB.
Use large scale, so the jpeg will not go under 1MB. I used scale of 0.95 because scale 1.0 doesn’t work.
If resulting jpeg should be greater than 1 MB then the resulting file will be very small and corrupted.
The problem seems to be in nppiEncodeHuffmanScan_JPEG_8u16s_P3R. Returned scan length is too small.
For files just below 1MB it works fine.