BUG: Prevent buffer overwrite in vtkJPEGWriter::Write

Fixes issue http://www.vtk.org/Bug/view.php?id=14129

Change-Id: I858e49a38615bf4a0b7b277bf9cc6d05afc10b2a
Merge topic '14129-vtkJPEGWriter_buffer_overflow' into master

b5c1107b BUG: Prevent buffer overwrite in vtkJPEGWriter::Write