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

ofColor undefined behavior #8166

Open
dimitre opened this issue Oct 31, 2024 · 3 comments
Open

ofColor undefined behavior #8166

dimitre opened this issue Oct 31, 2024 · 3 comments

Comments

@dimitre
Copy link
Member

dimitre commented Oct 31, 2024

today I was analyzing code in XCode with address sanitizer on, undefined behavior sanitizer and it indicates an UB on ofColor

Screenshot 2024-10-31 at 00 03 17
ofColor.cpp:172:7: runtime error: 2.14748e+09 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:172:7 in 
ofColor.cpp:173:7: runtime error: 2.14748e+09 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:173:7 in 
ofColor.cpp:174:7: runtime error: 2.14748e+09 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:174:7 in 
ofColor.cpp:175:7: runtime error: 2.14748e+09 is outside the range of representable values of type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:175:7 in 
ofColor.cpp:172:7: runtime error: 4.29497e+09 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:172:7 in 
ofColor.cpp:173:7: runtime error: 4.29497e+09 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:173:7 in 
ofColor.cpp:174:7: runtime error: 4.29497e+09 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:174:7 in 
ofColor.cpp:175:7: runtime error: 4.29497e+09 is outside the range of representable values of type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:175:7 in 
ofColor.cpp:172:7: runtime error: 9.22337e+18 is outside the range of representable values of type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:172:7 in 
ofColor.cpp:173:7: runtime error: 9.22337e+18 is outside the range of representable values of type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:173:7 in 
ofColor.cpp:174:7: runtime error: 9.22337e+18 is outside the range of representable values of type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:174:7 in 
ofColor.cpp:175:7: runtime error: 9.22337e+18 is outside the range of representable values of type 'long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:175:7 in 
ofColor.cpp:172:7: runtime error: 1.84467e+19 is outside the range of representable values of type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:172:7 in 
ofColor.cpp:173:7: runtime error: 1.84467e+19 is outside the range of representable values of type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:173:7 in 
ofColor.cpp:174:7: runtime error: 1.84467e+19 is outside the range of representable values of type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:174:7 in 
ofColor.cpp:175:7: runtime error: 1.84467e+19 is outside the range of representable values of type 'unsigned long'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ofColor.cpp:175:7 in 
setFbo 

and another one in ofGLProgrammableRenderer::draw

Screenshot 2024-10-31 at 00 05 59
@roymacdonald
Copy link
Member

not sure why the ofColor_ constructor takes floats instead of PixelType. I would assume it is because of that.

@dimitre
Copy link
Member Author

dimitre commented Oct 31, 2024

@roymacdonald I thought the same.
@NickHardeman any downside of using PixelType as the template parameter?

@NickHardeman
Copy link
Contributor

@dimitre I can't think of any....
Not sure about the programmable renderer, all of those values in the if statement are bools

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

No branches or pull requests

3 participants