bug found in parsettf.c:_readencstring()

"Janssen, Norbert" <[email protected]>
Newsgroups gmane.comp.fonts.fontforge.devel
Message-ID <[email protected]>
In the file parsettf.c:
static char *_readencstring(FILE *ttf,int offset,int len,
       int platform,int specific,int language) {
             long pos = ftell(ttf);
             unichar_t *str, *pt;
             char *ret;
             int i, ch;
             Encoding *enc;

             fseek(ttf,offset,SEEK_SET);

             if ( platform==1 ) {
                    /* Mac is screwy, there are several different varients of MacRoman */
                    /*  depending on the language, they didn't get it right when they  */
                    /*  invented their script system */
                    char *cstr, *cpt;
                    cstr = cpt = galloc(len+1);
                    for ( i=0; i<len; ++i )
                           *cpt++ = getc(ttf);
                    *cpt = '\0';
                    ret = MacStrToUtf8(cstr,specific,language);
                    free(cstr);
             } else {
                    enc = enc_from_platspec(platform,specific);
             if (enc == NULL)
             {
                 fseek(ttf, pos, SEEK_SET);                    <<== this is missing.
                 return(NULL);
             }

When checking a truetype font (HGGBAGS.TTF e.g.  with platformId=3 and specificId=2) the enc_from_platspec() returns a NULL.
Thus _readencstring() will return without resetting the readptr


_readencstring is used in TTFAddLangStr(), which is used in readttfcopyrights().
Readttfcopyrights() iterates over the name-table entries. But if an unsupported plat/spec combination is found,
It messes up the readptr in the truetypefile.
--
Norbert Janssen
Software Engineer * (SD-1 R&D)
Océ-Technologies B.V. * A Canon Group Company
P.O. Box 101 * 5900 MA  Venlo
St. Urbanusweg 43 * 5914 CA  Venlo * The Netherlands
T +31 (0)77 359 3599 M +31 (0)6 3375 4843 F +31 (0)77 359 5473
E [email protected] W www.oce.com<http://www.oce.com/>
Océ enables its customers to manage their documents efficiently and effectively by offering innovative print and document management products and services for professional environments.
Trade Register: 12002662

This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message. Thank you for your co-operation.

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds

_______________________________________________
Fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.