You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Thiruvalluvan M. G. (JIRA)" <ji...@apache.org> on 2013/06/13 21:07:21 UTC
[jira] [Assigned] (AVRO-1080) JsonIO.cc should allow \u escape
sequence in string
[ https://issues.apache.org/jira/browse/AVRO-1080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thiruvalluvan M. G. reassigned AVRO-1080:
-----------------------------------------
Assignee: Keh-Li Sheng
> JsonIO.cc should allow \u escape sequence in string
> ---------------------------------------------------
>
> Key: AVRO-1080
> URL: https://issues.apache.org/jira/browse/AVRO-1080
> Project: Avro
> Issue Type: Bug
> Components: c++
> Affects Versions: 1.6.3
> Environment: C++
> Reporter: Keh-Li Sheng
> Assignee: Keh-Li Sheng
> Fix For: 1.7.0
>
> Attachments: AVRO-1080.patch
>
>
> If an avro string contains a unicode escape sequence that begins with "\u" instead of "\U" an exception is thrown by the parser. The problematic code is at JsonIO.cc line 269.
> {code}
> JsonParser::Token JsonParser::tryString()
> {
> sv.clear();
> for ( ; ;) {
> char ch = in_.read();
> if (ch == '"') {
> return tkString;
> } else if (ch == '\\') {
> ch = in_.read();
> switch (ch) {
> case '"':
> case '\\':
> case '/':
> sv.push_back(ch);
> continue;
> case 'b':
> sv.push_back('\b');
> continue;
> case 'f':
> sv.push_back('\f');
> continue;
> case 'n':
> sv.push_back('\n');
> continue;
> case 'r':
> sv.push_back('\r');
> continue;
> case 't':
> sv.push_back('\t');
> continue;
> case 'U':
> {
> unsigned int n = 0;
> char e[4];
> in_.readBytes(reinterpret_cast<uint8_t*>(e), 4);
> for (int i = 0; i < 4; i++) {
> n *= 16;
> char c = e[i];
> if (isdigit(c)) {
> n += c - '0';
> } else if (c >= 'a' && c <= 'f') {
> n += c - 'a' + 10;
> } else if (c >= 'A' && c <= 'F') {
> n += c - 'A' + 10;
> } else {
> unexpected(c);
> }
> }
> sv.push_back(n);
> }
> break;
> default:
> unexpected(ch);
> }
> } else {
> sv.push_back(ch);
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira