fix(util/name): avoid assertion violation when reading numeric names

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-08-07 08:31:34 -07:00
parent 6d6c62461f
commit 9a6df02683
2 changed files with 2 additions and 1 deletions

View file

@ -440,7 +440,7 @@ public:
switch (k) { switch (k) {
case LL_ANON: return name(); case LL_ANON: return name();
case LL_STRING: return name(d.read_string().c_str()); case LL_STRING: return name(d.read_string().c_str());
case LL_INT: return name(name(), d.read_unsigned()); case LL_INT: return name(name(), d.read_unsigned(), true);
case LL_STRING_PREFIX: { case LL_STRING_PREFIX: {
name prefix = read(); name prefix = read();
return name(prefix, d.read_string().c_str()); return name(prefix, d.read_string().c_str());

View file

@ -26,6 +26,7 @@ public:
struct imp; struct imp;
private: private:
friend int cmp(imp * i1, imp * i2); friend int cmp(imp * i1, imp * i2);
friend class name_deserializer;
imp * m_ptr; imp * m_ptr;
explicit name(imp * p); explicit name(imp * p);
explicit name(unsigned k); explicit name(unsigned k);