[vlc-devel] [PATCH 2/5] input: es_out_timeshift: use same offset for queries

Francois Cartegnie fcvlcdev at free.fr
Mon Apr 20 20:27:26 CEST 2020


If you end up reading a pointer instead of query,
all priv/public controls guards breaks.
---
 src/input/es_out_timeshift.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 7c1d2d0095..dbff49d4c5 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -88,8 +88,8 @@ typedef struct attribute_packed
 
 typedef struct attribute_packed
 {
-    input_source_t *in;
     int  i_query;
+    input_source_t *in;
 
     union
     {
@@ -158,6 +158,10 @@ typedef struct attribute_packed
     } u;
 } ts_cmd_privcontrol_t;
 
+static_assert(offsetof(ts_cmd_control_t, i_query) ==
+              offsetof(ts_cmd_privcontrol_t, i_query),
+              "query control offset is inconsistent");
+
 typedef struct attribute_packed
 {
     int8_t  i_type;
-- 
2.25.3



More information about the vlc-devel mailing list