Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 541 by matt.k...@undue.org: Double decode in google.protobuf.text_format._CUnescape
http://code.google.com/p/protobuf/issues/detail?id=541

What steps will reproduce the problem?

  >>> print google.protobuf.text_format._CUnescape('\\x5c')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 691, in _CUnescape
      return result.decode('string_escape')
  ValueError: Trailing \ in string

What is the expected output? What do you see instead?

The expected output is a single backslash. _CUnescape works if the input is instead given in octal:

  >>> print google.protobuf.text_format._CUnescape('\\134')
  \

When the input is given in hex the escaped backslash is unescaped _twice_, once in the re.sub() and once in the str.decode().

I'm not using the trunk HEAD but I can see that the issue is still present.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to