-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix sal warnings #2279
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
Fix sal warnings #2279
Conversation
|
@ThomsonTan, @leirocks can you please review ? |
| if (m_func->IsOOPJIT()) | ||
| { | ||
| Js::ThrowMapEntry * throwMap = NativeCodeDataNewArrayNoFixup(m_func->GetNativeCodeDataAllocator(), Js::ThrowMapEntry, m_pragmaInstrToRecordMap->Count()); | ||
| for (int32 i = 0; i < m_pragmaInstrToRecordMap->Count(); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i < m_pragmaInstrToRecordMap->Count() [](start = 30, length = 37)
What's the problem in i < m_progmaInstrToRecordMap, type mismatch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calls to m_pragmaInstrToRecordMap->Count() for AllocatorArray and loop counter is not recognized as equivalent by the analyzer.
| { | ||
| Js::ThrowMapEntry * throwMap = NativeCodeDataNewArrayNoFixup(m_func->GetNativeCodeDataAllocator(), Js::ThrowMapEntry, m_pragmaInstrToRecordMap->Count()); | ||
| for (int32 i = 0; i < m_pragmaInstrToRecordMap->Count(); i++) | ||
| int allocSize = m_pragmaInstrToRecordMap->Count(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int [](start = 12, length = 3)
Use int32 to declare allocSize to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| } | ||
| #else | ||
| Assert(sizeCat == sizeof(Js::JavascriptNumber)); | ||
| __analysis_assume(sizeCat == sizeof(Js::JavascriptNumber)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__analysis_assume(sizeCat == sizeof(Js::JavascriptNumber)); [](start = 12, length = 59)
Why only need this if RECYCLER_MEMORY_VERIFY is not defined? I don't see it is set when RECYCLER_MEMORY_VERIFY is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RECYCLER_MEMORY_VERIFY means it's checked build, which looks we don't run pre-fast with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no warning when RECYCLER_MEMORY_VERIFY is defined, pLocalNumber is allocated as :
pLocalNumber = (Js::JavascriptNumber*)alloca(sizeCat);
So at WriteProcessMemory(hProcess, (void*)number, pLocalNumber, sizeCat, NULL) there will be no warning from the analyzer, saying pLocalNumber should be >= sizeCat.
Also looks like when RECYCLER_MEMORY_VERIFY is defined sizeCat can be larger than sizeof(Js::JavascriptNumber).
|
|
1 similar comment
|
|
Add annotation in CodeGenNumberAllocator.cpp to suppress sal warning. Restructure code in Encoder.cpp, the two function calls were throwing off the analyzer.
Merge pull request #2279 from meg-gupta:fixsal Add annotation in CodeGenNumberAllocator.cpp to suppress sal warning. Restructure code in Encoder.cpp, the two function calls were throwing off the analyzer.
Merge pull request #2279 from meg-gupta:fixsal Add annotation in CodeGenNumberAllocator.cpp to suppress sal warning. Restructure code in Encoder.cpp, the two function calls were throwing off the analyzer.
Add annotation in CodeGenNumberAllocator.cpp to suppress sal warning.
Restructure code in Encoder.cpp, the two function calls were throwing off
the analyzer.