Skip to content

Fix division by zero vulnerability in graph utilities multiplication optimization#999

Open
gap-editor wants to merge 1 commit into
zkonduit:mainfrom
gap-editor:main
Open

Fix division by zero vulnerability in graph utilities multiplication optimization#999
gap-editor wants to merge 1 commit into
zkonduit:mainfrom
gap-editor:main

Conversation

@gap-editor
Copy link
Copy Markdown

Summary

This PR fixes a critical logical error that could cause runtime panics due to division by zero in the graph utilities module.

Problem

In src/graph/utilities.rs at line 1055, the code performs division 1.0 / c.raw_values[0] after only checking that c.raw_values[0] < 1.0. This condition allows c.raw_values[0] to be exactly 0.0, which would cause a division by zero panic at runtime.

Solution

Added an explicit check && c.raw_values[0] != 0.0 to the existing conditional to ensure the division operation is only performed when the divisor is guaranteed to be non-zero.

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.

1 participant