Skip to content

Commit 582b512

Browse files
committed
[MERGE #2310 @dilijev] Fix VSO 10259529: Add assertion to satisfy analysis of descriptors[descCount]
Merge pull request #2310 from dilijev:bug10259529 Fix VSO 10259529: Add assertion to satisfy analysis of descriptors[descCount] in JavascriptObject::DefinePropertiesHelperForGenericObjects. Fix some OACR warnings about non-const locals in JavascriptObject.cpp since I was already fixing an OACR warning in the area.
2 parents 16f7a28 + 9e09807 commit 582b512

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/Runtime/Library/JavascriptObject.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ namespace Js
486486
if (type == TypeIds_HostDispatch)
487487
{
488488
RecyclableObject* hostDispatchObject = RecyclableObject::FromVar(thisArg);
489-
DynamicObject* remoteObject = hostDispatchObject->GetRemoteObject();
489+
const DynamicObject* remoteObject = hostDispatchObject->GetRemoteObject();
490490
if (!remoteObject)
491491
{
492492
Var result = nullptr;
@@ -1726,6 +1726,7 @@ namespace Js
17261726

17271727
tempVar = JavascriptOperators::GetProperty(props, propId, scriptContext);
17281728

1729+
AnalysisAssert(descCount < descSize);
17291730
if (!JavascriptOperators::ToPropertyDescriptor(tempVar, &descriptors[descCount].descriptor, scriptContext))
17301731
{
17311732
JavascriptError::ThrowTypeError(scriptContext, JSERR_PropertyDescriptor_Invalid, scriptContext->GetPropertyName(propId)->GetBuffer());
@@ -1900,7 +1901,7 @@ namespace Js
19001901
&& _wcsicmp(Js::ScriptFunction::FromVar(descriptor.GetGetter())->GetFunctionProxy()->GetDisplayName(), _u("get")) == 0)
19011902
{
19021903
// modify to name.get
1903-
char16* finalName = ConstructName(propertyRecord, _u(".get"), scriptContext);
1904+
const char16* finalName = ConstructName(propertyRecord, _u(".get"), scriptContext);
19041905
if (finalName != nullptr)
19051906
{
19061907
FunctionProxy::SetDisplayNameFlags flags = (FunctionProxy::SetDisplayNameFlags) (FunctionProxy::SetDisplayNameFlagsDontCopy | FunctionProxy::SetDisplayNameFlagsRecyclerAllocated);
@@ -1915,7 +1916,7 @@ namespace Js
19151916
&& _wcsicmp(Js::ScriptFunction::FromVar(descriptor.GetSetter())->GetFunctionProxy()->GetDisplayName(), _u("set")) == 0)
19161917
{
19171918
// modify to name.set
1918-
char16* finalName = ConstructName(propertyRecord, _u(".set"), scriptContext);
1919+
const char16* finalName = ConstructName(propertyRecord, _u(".set"), scriptContext);
19191920
if (finalName != nullptr)
19201921
{
19211922
FunctionProxy::SetDisplayNameFlags flags = (FunctionProxy::SetDisplayNameFlags) (FunctionProxy::SetDisplayNameFlagsDontCopy | FunctionProxy::SetDisplayNameFlagsRecyclerAllocated);
@@ -1932,7 +1933,7 @@ namespace Js
19321933
BOOL returnValue;
19331934
obj->ThrowIfCannotDefineProperty(propId, descriptor);
19341935

1935-
Type* oldType = obj->GetType();
1936+
const Type* oldType = obj->GetType();
19361937
obj->ClearWritableDataOnlyDetectionBit();
19371938

19381939
// HostDispatch: it doesn't support changing property attributes and default attributes are not per ES5,

0 commit comments

Comments
 (0)