Browse Source

fix(src/json): fix parsing error when inf is dumped as a Number

GitOrigin-RevId: 62cfba48c0
release-1.6
Megvii Engine Team 3 years ago
parent
commit
f9722af3df
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      src/core/impl/utils/json.cpp

+ 8
- 0
src/core/impl/utils/json.cpp View File

@@ -52,6 +52,14 @@ void Value::writeto_fpath(const char* fout_path, int indent) const {
}

void Number::writeto(std::string& fout, int) const {
if (std::isinf(m_val)){
fout += "\"inf\"";
return ;
}
if (std::isnan(m_val)){
fout += "\"nan\"";
return ;
}
static char fmt[16];
static Spinlock fmt_mtx;
if (!fmt[sizeof(fmt) - 1]) {


Loading…
Cancel
Save