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

Missing interger overflow check in TensorFlow #58994

Closed
edwardyehuang opened this issue Dec 24, 2022 · 10 comments
Closed

Missing interger overflow check in TensorFlow #58994

edwardyehuang opened this issue Dec 24, 2022 · 10 comments
Assignees
Labels
python Pull requests that update Python code stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author TF 2.10 type:bug Bug

Comments

@edwardyehuang
Copy link
Contributor

edwardyehuang commented Dec 24, 2022

Click to expand!

Issue Type

Bug

Source

source

Tensorflow Version

tf 2.10

Custom Code

Yes

OS Platform and Distribution

No response

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

Tensorflow does not check integer overflow, which is dangerous and can cause bugs for many users.

Standalone code to reproduce the issue

a = 2147483648
print(tf.convert_to_tensor(a, tf.int32))

BUG case:

print(a* tf.constant(1, tf.int32))

Relevant log output

No response

@mohantym
Copy link
Contributor

@edwardyehuang !
Thanks for the PR #58996. This issue will be closed once PR is merged.
Thank you!

@mohantym mohantym added the awaiting PR merge awaiting PR merge label Dec 26, 2022
@Rishikesh2338
Copy link

If this Pr is not assigned to anyone I can do this.

@mohantym
Copy link
Contributor

mohantym commented Jan 12, 2023

Sure @Rishikesh2338 !

The Fix has to be replicated in C++ side as per mihai's comment.
Possible location is ops.cc.

will post an update by End of week.

Thank you!

@mohantym
Copy link
Contributor

mohantym commented Feb 8, 2023

Hi @SuryanarayanaY !
Could you look at this issue. Attached gist in 2.9, 2.10, 2.11 for reference.
Thank you!

@mohantym mohantym assigned SuryanarayanaY and unassigned mohantym Feb 8, 2023
@edwardyehuang
Copy link
Contributor Author

Hi @SuryanarayanaY ! Could you look at this issue. Attached gist in 2.9, 2.10, 2.11 for reference. Thank you!

Note that, this is not only the issue in tf.convert_to_tensor.

The example below is also dangerous.

import tensorflow as tf

a = 2147483647
a = tf.convert_to_tensor(a, tf.int32)

print(a) # tf.Tensor(2147483647, shape=(), dtype=int32)

b = a + tf.constant(1, tf.int32)

print(b) # tf.Tensor(-2147483648, shape=(), dtype=int32)

@edwardyehuang
Copy link
Contributor Author

edwardyehuang commented Mar 23, 2023

@mihaimaruseac @mohantym Could you remove the label "awaiting PR merge" please?

@SuryanarayanaY SuryanarayanaY removed the awaiting PR merge awaiting PR merge label Mar 23, 2023
@SuryanarayanaY
Copy link
Collaborator

@edwardyehuang ,

Removed the label awaiting PR merge as requested. Could you please confirm whether you are willing to work on this issue? Thanks!

@SuryanarayanaY SuryanarayanaY added the stat:awaiting response Status - Awaiting response from author label Mar 23, 2023
@github-actions
Copy link

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Mar 31, 2023
@github-actions
Copy link

github-actions bot commented Apr 8, 2023

This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.

@github-actions github-actions bot closed this as completed Apr 8, 2023
@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author TF 2.10 type:bug Bug
Projects
None yet
Development

No branches or pull requests

4 participants