-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Description
Operating System Info
Other
Other OS
all OS
OBS Studio Version
Git
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://eel.is/c++draft/defns.undefined
OBS Studio Crash Log URL
No response
Expected Behavior
defined behavior
Current Behavior
3.65 [defns.undefined] undefined behavior
behavior for which this document imposes no requirements
[Note 1: Undefined behavior may be expected when this document omits any explicit definition of behavior or when a program uses an incorrect construct or invalid data. Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message ([defns.diagnostic])), to terminating a translation or execution (with the issuance of a diagnostic message). Many incorrect program constructs do not engender undefined behavior; they are required to be diagnosed. Evaluation of a constant expression ([expr.const]) never exhibits behavior explicitly specified as undefined in [intro] through [cpp]. — end note]
these lines cause undefined behavior:
obs-studio/libobs/util/util_uint128.h
Line 83 in 8e129b1
out = util_add128(out, util_lshift64_internal_32(m)); |
obs-studio/libobs/util/util_uint128.h
Line 86 in 8e129b1
out = util_add128(out, util_lshift64_internal_64(m)); |
here output is union with uint32_t i32[4];
active member,
obs-studio/libobs/util/util_uint128.h
Line 49 in 8e129b1
out.i32[3] = (uint32_t)val; |
but read as
struct {
uint64_t low;
uint64_t high;
};
here:
obs-studio/libobs/util/util_uint128.h
Line 36 in 8e129b1
val = (a.low & 0xFFFFFFFFULL) + (b.low & 0xFFFFFFFFULL); |
uint32_t i32[4];
and struct { uint64_t low; uint64_t high; };
are not same standard-layout!
https://eel.is/c++draft/basic.life#2.sentence-3
https://eel.is/c++draft/class.union#general-2
https://eel.is/c++draft/basic.life#8
https://en.cppreference.com/w/cpp/language/union
other links:
https://gitlab.com/libeigen/eigen/-/issues/2898
arduino/ArduinoCore-API#225
Steps to Reproduce
compile and using
Anything else we should know?
No response