From 53ae78f1bb2acdf5b667efc7a66ef335a2049a88 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 19 Dec 2016 09:23:54 +0000 Subject: [PATCH] Fix for javascript parseInt of strings that start with a zero but contain non-numeric chars --- modules/juce_core/javascript/juce_Javascript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 7f09f0cba2..f3ba80d2fb 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -106,7 +106,7 @@ struct JavascriptEngine::RootObject : public DynamicObject static bool isFunction (const var& v) noexcept { return dynamic_cast (v.getObject()) != nullptr; } static bool isNumeric (const var& v) noexcept { return v.isInt() || v.isDouble() || v.isInt64() || v.isBool(); } static bool isNumericOrUndefined (const var& v) noexcept { return isNumeric (v) || v.isUndefined(); } - static int64 getOctalValue (const String& s) { BigInteger b; b.parseString (s, 8); return b.toInt64(); } + static int64 getOctalValue (const String& s) { BigInteger b; b.parseString (s.initialSectionContainingOnly ("01234567"), 8); return b.toInt64(); } static Identifier getPrototypeIdentifier() { static const Identifier i ("prototype"); return i; } static var* getPropertyPointer (DynamicObject* o, const Identifier& i) noexcept { return o->getProperties().getVarPointer (i); }