Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception 0x770DC5AF when i read an special char in json file #2106

Closed
raoul632 opened this issue May 14, 2020 · 7 comments
Closed

exception 0x770DC5AF when i read an special char in json file #2106

raoul632 opened this issue May 14, 2020 · 7 comments
Labels
kind: bug state: needs more info the author of the issue needs to provide more details

Comments

@raoul632
Copy link

  • What is the issue you have?
    when i try to read a json file application crash

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
    just a special char like ê in the json file, can crash application at runtime
    in json hpp at line 4982
    case 4:
    JSON_THROW(static_cast<const detail::out_of_range>(&ex));

  • What is the expected behavior?
    report i can't read your actual json file.

  • And what is the actual behavior instead?
    application crashed

  • Which compiler and operating system are you using? Is it a supported compiler?
    visual studio 2019 community and win 7

  • Did you use a released version of the library or the version from the develop branch?
    the released version

  • If you experience a compilation error: can you compile and run the unit tests?

@nlohmann
Copy link
Owner

I need more information:

  • How does the file you want to read look like?
  • What is the code you execute to read the file?
  • Which function is called when the exception is raised?
  • Do you have a backtrace?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label May 14, 2020
@raoul632
Copy link
Author

my json file look like this :
{
"page_1":{
"texte":"vous êtes sur un chemin en terre battus la lumiere vous ebloui mais vous pouvez voir cette etrange porte",
"actions":{
"move_to":2
}
}
}

the code to read :
std::ifstream ifs("livre.json");
json jf = json::parse(ifs); <-- the function parse raise this exception

the backtrace (where is stoping in the stack ) :

ConsoleApplication1.exe!nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<std::map,std::vector,std::string,bool,__int64,unsigned __int64,double,std::allocator,nlohmann::adl_serializer,std::vector<unsigned char,std::allocator>>>::parse_error(unsigned int __formal, const std::string & __formal, const nlohmann::detail::exception & ex) Ligne 4982 C++

Capture

@nlohmann
Copy link
Owner

Is the JSON file UTF-8 encoded?

@raoul632
Copy link
Author

you find the problem. sorry
its encoded in ansi by default

@nlohmann
Copy link
Owner

Could you send me the file or attach it? I tried to reproduce the error locally, but only got this exception if I save the JSON you mentioned with non-UTF-8 encoding:

[json.exception.parse_error.101] parse error at line 3, column 25: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '"vous \352t'

I did not get a out_of_range exception.

@raoul632
Copy link
Author

sorry i didn't see the notification :
i can crash with this file
livre.zip

@nlohmann
Copy link
Owner

Thanks. I again get this error:

[json.exception.parse_error.101] parse error at line 3, column 24: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '"vous \352t'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

2 participants