Bugs item #3426020, was opened at 2011-10-19 17:29
Message generated for change (Tracker Item Submitted) made by dalke
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=428740&aid=3426020&group_id=40728

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andrew Dalke (dalke)
Assigned to: Nobody/Anonymous (nobody)
Summary: SMILES parser should fail with bad characters

Initial Comment:
formats/smilesformat.cpp contains the two lines (starting at line 407)

    if (*_ptr<0 || isspace(*_ptr))
              continue;

This tells it to ignore any whitespace in the SMILES string (so the non-SMILES 
"C P" gets interpreted as "CP").

It also tells the parser to ignore any bytes with the high bit set.

The latter is a problem if the input comes from a UTF-8 encoded source, where 
the non-ASCII characters are encoded with bytes which set the high bit. It 
means that an input like "CöP" will be interpreted as "CP".

The fix should be:

    if (*_ptr<0 || isspace(*_ptr))
              return false;  // unsupported character

BTW, ideally "_ptr" should be a "signed char *". SGIs, for example, used an 
unsigned char as the default "char" type. I don't know if this is important 
these days.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=428740&aid=3426020&group_id=40728

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to