Skip to content

Ensure the hash length (3x)#896

Merged
shargon merged 3 commits intoneo-project:masterfrom
shargon:fix-invalid-uintdata
Jul 9, 2019
Merged

Ensure the hash length (3x)#896
shargon merged 3 commits intoneo-project:masterfrom
shargon:fix-invalid-uintdata

Conversation

@shargon
Copy link
Copy Markdown
Member

@shargon shargon commented Jul 8, 2019

Before this patch, was possible to parse an array of hashes only with the length of the array, so is easier to produce undesired results.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 8, 2019

Codecov Report

Merging #896 into master will decrease coverage by 0.02%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #896      +/-   ##
==========================================
- Coverage   45.05%   45.03%   -0.03%     
==========================================
  Files         178      178              
  Lines       12600    12608       +8     
==========================================
+ Hits         5677     5678       +1     
- Misses       6923     6930       +7
Impacted Files Coverage Δ
neo/Cryptography/ECC/ECPoint.cs 75% <30%> (-1.3%) ⬇️
neo/UIntBase.cs 54.54% <60%> (-1.27%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bb75ec...ea99256. Read the comment docs.

void ISerializable.Deserialize(BinaryReader reader)
{
reader.Read(data_bytes, 0, data_bytes.Length);
if (reader.Read(data_bytes, 0, data_bytes.Length) != data_bytes.Length)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds redudant but maybe looks necessary, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could you read something and it be different than the size of it?

Copy link
Copy Markdown
Member Author

@shargon shargon Jul 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With less data.
Is possible to read 1 byte, but only the first byte in the array will be filled

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But how less, since data_byte.Lenght was fixed?
I will leave this for you guys, too deep to me...aheuaheauea jajaja
I will talk to Igor.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vncoelho it reads up to "length", it doesn't mean it will always read that length (if it has only one byte, like Shargon mentioned)

lock9
lock9 previously approved these changes Jul 9, 2019
@shargon shargon merged commit 54e772a into neo-project:master Jul 9, 2019
@shargon shargon deleted the fix-invalid-uintdata branch July 9, 2019 08:10
Thacryba pushed a commit to simplitech/neo that referenced this pull request Feb 17, 2020
* Update cli.md

* Update cli.md
Tommo-L pushed a commit to Tommo-L/neo that referenced this pull request Jun 22, 2020
* Ensure the hash length

* Update UIntBase.cs

* Fix ecpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants