Skip to content
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

Document assumptions that are being made to avoid division by zero #11133

Merged
merged 1 commit into from Oct 12, 2017

Conversation

practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Aug 25, 2017

Document assumptions (via assert(…):s) that are being made to avoid division by zero.

Rationale:

  • Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

@practicalswift practicalswift changed the title Document assumptions that must be fulfilled to avoid division by zero Document assumptions that are being made to avoid division by zero Aug 25, 2017
@meshcollider
Copy link
Contributor

Hmm does adding that text change the behavior of the static analyzers? Otherwise it seems pretty human readable to me already, they aren't exactly complicated asserts :)

@sipa
Copy link
Member

sipa commented Aug 27, 2017

Agree with @meshcollider.

@danra
Copy link
Contributor

danra commented Aug 27, 2017

utACK for asserting != 0 where added.
Agree with @meshcollider that the extra text is redundant.

@practicalswift
Copy link
Contributor Author

@meshcollider @sipa @danra Thanks for reviewing! Redundant comments removed. Looks good? :-)

@meshcollider
Copy link
Contributor

Yep, utACK 55509f1

@laanwj
Copy link
Member

laanwj commented Oct 12, 2017

utACK 55509f1

@laanwj laanwj merged commit 55509f1 into bitcoin:master Oct 12, 2017
laanwj added a commit that referenced this pull request Oct 12, 2017
…ion by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
laanwj added a commit that referenced this pull request Oct 18, 2017
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in #11133
  Reported by @mzhou, fixes #11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 25, 2019
…sion by zero

Summary:
55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e

Backport of Core PR11133
bitcoin/bitcoin#11133

Test Plan:
  make check
  test_runner.py

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3695
jonspock pushed a commit to jonspock/devault that referenced this pull request Sep 5, 2019
…sion by zero

Summary:
55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e

Backport of Core PR11133
bitcoin/bitcoin#11133

Test Plan:
  make check
  test_runner.py

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3695
jonspock pushed a commit to jonspock/devault that referenced this pull request Sep 6, 2019
…sion by zero

Summary:
55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e

Backport of Core PR11133
bitcoin/bitcoin#11133

Test Plan:
  make check
  test_runner.py

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3695
proteanx pushed a commit to devaultcrypto/devault that referenced this pull request Sep 6, 2019
…sion by zero

Summary:
55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e

Backport of Core PR11133
bitcoin/bitcoin#11133

Test Plan:
  make check
  test_runner.py

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3695
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 22, 2019
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 22, 2019
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 4, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 4, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 16, 2020
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
@practicalswift practicalswift deleted the div0 branch April 10, 2021 19:32
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 22, 2022
…d division by zero

55509f1 Document assumptions that are being made to avoid division by zero (practicalswift)

Pull request description:

  Document assumptions (via `assert(…)`:s) that are being made to avoid division by zero.

  Rationale:
  * Make it clear to human reviewers and non-human static analyzers that what might look like potential division by zero cases are written the way they are intentionally (these cases are currently flagged by various static analyzers).

Tree-SHA512: bbb67b1370afd8f39bda35f9e3a20f4325f017d94cc1bfac3b0d36c9f34c2d95a9efe11efe44db29fb4aadd25d8276d8f0e03c8806ac64f0d21d821912e13b8e
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 22, 2022
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
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.

None yet

5 participants