Skip to content

Incorrect parse error with binary data in keys? #838

@charlie-ht

Description

@charlie-ht

Bug Report

  • What is the issue you have?
    I get a parse error after deserializing a map<string, string>, the serialised message was created by same version of library. The key is binary data. The error message is not helpful to find what went wrong.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
    m_message below contains the data to parse, the library seems to have done some escaping of my data but a quick inspection of the data suggests it's valid.

m_message is {"g\u0007\r\"(G&߆":"KeyUsable","{\u0013(T[\u001e>":"KeyUsable","x R\u0000W}UF":"KeyUsable","u000e\u0012]=_":"KeyUsable"}
00000000 7b 22 67 5c 75 30 30 30 37 5c 72 d7 7e d6 5f 5c |{"g\u0007\r.~._\|
00000010 22 ae 28 47 26 df 86 f7 7f 22 3a 22 4b 65 79 55 |".(G&....":"KeyU|
00000020 73 61 62 6c 65 22 2c 22 7b 5c 75 30 30 31 33 28 |sable","{\u0013(|
00000030 eb 61 b5 54 e2 93 f7 5b 5c 75 30 30 31 65 3e 94 |.a.T...[\u001e>.|
00000040 cc 3b 22 3a 22 4b 65 79 55 73 61 62 6c 65 22 2c |.;":"KeyUsable",|
00000050 22 93 78 99 20 e8 d6 52 5c 75 30 30 30 30 98 57 |".x....R\u0000.W|
00000060 7d f8 f2 dd 55 46 22 3a 22 4b 65 79 55 73 61 62 |}...UF":"KeyUsab|
00000070 6c 65 22 2c 22 f0 92 9b 5c 75 30 30 30 65 5c 75 |le","...\u000e\u|
00000080 30 30 31 32 c8 5e 5d 95 fe 3d 5f da e6 fb a8 22 |0012.^]..=_...."|
00000090 3a 22 4b 65 79 55 73 61 62 6c 65 22 7d          |:"KeyUsable"}   |
terminate called after throwing an instance of 'std::invalid_argument'
  what():  parse error - unexpected '"'; expected string literal

I provide hexdump of message above the given error. That error isn't enough for me to understand what went wrong.

  • What is the expected behavior?
-{
"g\u0007\r\"(G&߆" : KeyUsable,
"{\u0013(T[\u001e>" : KeyUsable,
"x R\u0000W}UF" : KeyUsable,
"u000e\u0012]=_" : KeyUsable
}
  • And what is the actual behavior instead?
    A crash, please see above
  • Which compiler and operating system are you using? Is it a supported compiler?
    arm-buildroot-linux-gnueabihf-g++.br_real (Buildroot 2017.05-git-13055-g71f35cff8-dirty) 5.4.0
  • Did you use a released version of the library or the version from the develop branch?
    ersion 2.1.1
  • If you experience a compilation error: can you compile and run the unit tests?
    No compilation error

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions