-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
ofNoise() -- Memory bad access issue #5820
Comments
@nicoleyimessier Did this cause any additional issues or did you find a solution? |
Huh. This could be an issue. Looking through the code for slang_library_noise3 I think the variable Here is the relevant part in the code: Going back to ii being set from i and i from xs I don't see anything that would stop any of those from being negative. If ii is negative then there will be an out of bounds with perm Would love a sanity check on this though |
Recently, I saw some strange and erratic behaviour in a piece of my openFrameworks code using ofNoise. After a long search, I could trace it back to the problem mentioned above. Try debugging into the call ofNoise(-13.7,14.6) and see what happens. Indices in perm become negative. Replacing all the %256 by &0xff solves this problem. Would be nice to fix this in future releases of of. |
@alexp-nl - it definitely seems like an issue to me. changing them to use &0xFF does fix the negative ii and jj it but the noise curve changes. Do you get erratic values with this code?
|
Note for positive values both look the same. The issue is the fix changes ii and jj like so: i = 0, i %256 = 0, i &0xFF = 0 hence the different graphs when negative. |
The curve should change, because the %256 version is wrong. It depends on data outside of the perm array. In my case, the erratic behaviour was caused by the changing of this data outside (before) the perm array. So two calls with the same parameters to ofNoise resulted in the different return values. |
Thanks @alexp-nl - this should be fixed in master / nightly now. |
Glad I could help, and thanks to everyone who has made openFrameworks what it is today! |
When running my app with address sanitizer, it quickly catches a bad access that happens within the noise library.
The text was updated successfully, but these errors were encountered: