I have parsed the bitstream to extract each block. I have counted the correct number of blocks based on the size of my image (3440) and it brings me nicely to the EOI marker ([255, 217]), so I am confident I have done this much correctly.
However there are ~1000 more bytes of data after this EOI marker, followed by another EOI. My image is greyscale and consists only of a Luminance component, as confirmed by the header. What is this mystery data??
It seems to be important in some way, because the image is an unintelligible mess if it is removed...