Menu

#845 byte order mark in lib causes fatal error

v1.0 (example)
closed-fixed
None
5
5 days ago
6 days ago
snzho
No

A UTF-8 file shouldn't include a byte order markk; however, I've run into vendor libs that include a BOM and this causes a fatal error. The problem could be patched by stripping:

--- a/src/frontend/inpcom.c
+++ b/src/frontend/inpcom.c
@@ -1392,6 +1392,13 @@
 #endif
         }


+        /* Strip a UTF-8 byte order mark at the start of a line -- i.e. at
+           the start of a file written by a Windows editor.  A BOM is never
+           legal SPICE syntax; left in place it glues to the first token
+           (fatal ".subckt/.ends mismatch" class errors in included libs). */
+        if (!intfile && buffer && strncmp(buffer, "\xEF\xBB\xBF", 3) == 0)
+            memmove(buffer, buffer + 3, strlen(buffer + 3) + 1);
+
 #ifdef TRACE
         /* SDB debug statement */
         printf("in inp_read, just read   %s", buffer);

Minimal repro files are attached.

2 Attachments

Discussion

  • Holger Vogt

    Holger Vogt - 5 days ago
    • status: open --> closed-fixed
    • assigned_to: Holger Vogt
     
  • Holger Vogt

    Holger Vogt - 5 days ago

    Thanks for your input.

    Patch is uploaded to development git branch pre-master-47.

     
  • snzho

    snzho - 5 days ago

    Thanks for applying the patch!

     

Log in to post a comment.

Auth0 Logo