Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
4d457a81
Commit
4d457a81
authored
Sep 26, 2018
by
soad003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
static analysis: change to new file structure
parent
5a9a733e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
stringBytesLength.js
...alyzer/src/solidity-analyzer/modules/stringBytesLength.js
+34
-0
staticAnalysisIntegration-test.js
...-analyzer/test/analysis/staticAnalysisIntegration-test.js
+2
-2
No files found.
remix-analyzer/src/solidity-analyzer/modules/stringBytesLength.js
0 → 100644
View file @
4d457a81
var
name
=
'String Length: '
var
desc
=
'Bytes length != String length'
var
categories
=
require
(
'./categories'
)
var
common
=
require
(
'./staticAnalysisCommon'
)
function
stringBytesLength
()
{
this
.
stringToBytesConversions
=
[]
this
.
bytesLengthChecks
=
[]
}
stringBytesLength
.
prototype
.
visit
=
function
(
node
)
{
if
(
common
.
isStringToBytesConversion
(
node
))
this
.
stringToBytesConversions
.
push
(
node
)
else
if
(
common
.
isBytesLengthCheck
(
node
))
this
.
bytesLengthChecks
.
push
(
node
)
}
stringBytesLength
.
prototype
.
report
=
function
(
compilationResults
)
{
if
(
this
.
stringToBytesConversions
.
length
>
0
&&
this
.
bytesLengthChecks
.
length
>
0
)
{
return
[{
warning
:
'Bytes and string length are not the same since strings are assumed to be UTF-8 encoded (according to the ABI defintion) therefore one character is not nessesarily encoded in one byte of data.'
,
location
:
this
.
bytesLengthChecks
[
0
],
more
:
'https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#argument-encoding'
}]
}
else
{
return
[]
}
}
module
.
exports
=
{
name
:
name
,
description
:
desc
,
category
:
categories
.
MISC
,
Module
:
stringBytesLength
}
remix-analyzer/test/analysis/staticAnalysisIntegration-test.js
View file @
4d457a81
...
...
@@ -487,7 +487,7 @@ test('Integration test selfdestruct.js', function (t) {
'selfdestruct.sol'
:
3
,
'deleteDynamicArray.sol'
:
0
,
'blockLevelCompare.sol'
:
0
,
'intDivisionTruncate.sol'
:
1
,
// 5
'intDivisionTruncate.sol'
:
5
,
'stringBytesLength.sol'
:
0
}
...
...
@@ -639,7 +639,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../src/
analysis
/modules/stringBytesLength'
)
var
module
=
require
(
'../../src/
solidity-analyzer
/modules/stringBytesLength'
)
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment