Skip to content

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Feb 1, 2022

It doesn't seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file.

This removes one of the two violations.

This should be a refactor.

Copy link
Contributor

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK aaaae5349d1d5985081751c3a3b7386333d48cef, I reviewed the code, and agree it makes sense to merge

@maflcko
Copy link
Member Author

maflcko commented Feb 1, 2022

I've pushed a new version, which:

  • is a smaller diff and easier to review, as it doesn't change any types
  • doesn't introduce a presumed signed-integer-overflow when the mempool.dat on disk is badly corrupted

Copy link
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

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

utACK

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Code Review ACK fadcd03

Tried running below code to confirm:

  uint64_t i = 4;
  while (--i)
  { 
  cout<<i;
  }
  cout<<i;
  
  uint64_t i = 4;
  while (i--)
  { 
  cout<<i;
  }
  cout<<i;
  
  uint64_t i = 4;
  while (i)
  { 
   --i;
  cout<<i;
  }
  cout<<i;
  

It is also according to coding style mentioned in docs: https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style-c

Copy link
Contributor

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

Is the PR name really accurate, this can't overflow, maybe only underflow?

@maflcko
Copy link
Member Author

maflcko commented Feb 7, 2022

No idea, but the suppression is called unsigned-integer-overflow, which is why I picked the title.

@PastaPastaPasta
Copy link
Contributor

No idea, but the suppression is called unsigned-integer-overflow, which is why I picked the title.

I presume there are more unsigned-integer-overflow in validation.cpp preventing you from removing the suppression?

@maflcko
Copy link
Member Author

maflcko commented Feb 7, 2022

Have you seen the pull request you commented on? #24196 (review)

@PastaPastaPasta
Copy link
Contributor

PastaPastaPasta commented Feb 7, 2022

Have you seen the pull request you commented on? #24196 (review)

Ahh, thanks, I forgot they were related / about that PR

@maflcko maflcko merged commit f7a3647 into bitcoin:master Feb 7, 2022
@maflcko maflcko deleted the 2202-intMem branch February 7, 2022 13:08
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 7, 2022
fadcd03 Fix unsigned integer overflow in LoadMempool (MarcoFalke)

Pull request description:

  It doesn't seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file.

  This removes one of the two violations.

  This should be a refactor.

ACKs for top commit:
  prayank23:
    Code Review ACK bitcoin@fadcd03

Tree-SHA512: 9fb2f3d49008a59cd45b7c17be0c88c04e61183197c11c8176865af5532c8d0c940db49a351dd0fc75e1d7fd8678c3b816d34cfca170dc6b9cf8f37fdf1c8cae
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 11, 2022
fadcd03 Fix unsigned integer overflow in LoadMempool (MarcoFalke)

Pull request description:

  It doesn't seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file.

  This removes one of the two violations.

  This should be a refactor.

ACKs for top commit:
  prayank23:
    Code Review ACK bitcoin@fadcd03

Tree-SHA512: 9fb2f3d49008a59cd45b7c17be0c88c04e61183197c11c8176865af5532c8d0c940db49a351dd0fc75e1d7fd8678c3b816d34cfca170dc6b9cf8f37fdf1c8cae
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Apr 19, 2022
fadcd03 Fix unsigned integer overflow in LoadMempool (MarcoFalke)

Pull request description:

  It doesn't seem ideal to have an integer sanitizer enabled, but then disable it for the whole validation.cpp file.

  This removes one of the two violations.

  This should be a refactor.

ACKs for top commit:
  prayank23:
    Code Review ACK bitcoin@fadcd03

Tree-SHA512: 9fb2f3d49008a59cd45b7c17be0c88c04e61183197c11c8176865af5532c8d0c940db49a351dd0fc75e1d7fd8678c3b816d34cfca170dc6b9cf8f37fdf1c8cae
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 19, 2022
Summary:
This should have been backported before removing the ubsan suppression in D12821

This is a backport of [[bitcoin/bitcoin#24227 | core#24227]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12914
@bitcoin bitcoin locked and limited conversation to collaborators Feb 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants