Optiboot issue where last bytes of an upload are 0xFF

A little issue that I chanced upon a couple weeks back, and which was nicely diagnosed with a lot of high-powered help from the forum :slight_smile:

Not sure what the official process is, but it seems like a fix may be in order, or at least it should be added to the known errors list.

See: When does -1 != -1 ? - #65 by Coding_Badly - Programming Questions - Arduino Forum

Were you affected by the bug? Did you have a sketch that failed to properly download?

Yes, although once the issue was understood it was easy enough to work around. I pared my sketch down to the bare minimum that would replicate the symptom, that sketch is in the first post of the referenced thread.