but if you want to allow that then no problems
The rant wasn't about your code, just about how some specification that was so simple eventually took on added requirements which do not exist. The 'but is also more permissive' phrase must have triggered me, as the specification already allows for any char(s) outside a record with a record mark char being the exception. I think in the distant past I wanted to add comments to some hex files for some reason, but of course the programmer did not like that. Certainly not a big problem and not very important but I do notice the deviation every time I run into a web site explaining the Intel hex format or see source code that parses hex files.
I've never heard of or seen any Intel Hex file with anything other than the records (and line endings) in it
You must have felt some need to deal with hex files that do not conform to the normal by consuming white space as you do, even though that will never be seen as you say. Whether Intel intended (likely) or not, by using a record mark and record length they managed to eliminate dealing with various combinations of line endings or anything else outside of a record.
Not that it matters, but your proposed code change only allows white space outside a record (anything other than a record mark should also be allowable), and also allows white space inside a record which I would argue is not allowed. Making minimal changes and leaving function names as-is, a couple lines would probably take care of it and conform to the spec-
37 while ( ch = fgetc(hex_file), (ch != ':') && (ch != EOF) ){}
44 int ch = fgetc(hex_file);
edit-
binutils in its ihex_scan function also will not like seeing anything outside a record other than \r or \n, so its a common thing to misinterpret/reinterpret the Intel hex format.
Its not a common need, but comments in a hex file could be useful in some cases and should have been an option/allowed from toolchains early on. A little late now as too many ships have already sailed with their new interpretations. A simple example would be for an avr- they have a mechanism to deal with fuses/eeprom and other non-flash memory spaces in a hex file and would have been nice if comments could be generated to mark these records. Once in a while you need to view the hex file to see what is actually generated for fuses, or to see that some address specified section got placed where you intended, and if comments between records were allowed (which the Intel hex format certainly allows) then it could have been helpful in some cases and would have no effect on the records.
These parsers DO typically allow comments after the end of file record where they usually will quit scanning the file, but some comments would only be useful if they preceded a record.