From dc66833247e6f7c458de7d917b486c0cf7e6daaa Mon Sep 17 00:00:00 2001 From: Wild Dragon Dev Date: Wed, 3 Jun 2026 20:15:54 +0000 Subject: [PATCH] fix: declare all slot functions in slot.h to prevent 64-bit pointer truncation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fc_slot_create, fc_slot_destroy, fc_slot_open, fc_slot_close, and fc_slot_write_frame were defined in slot.c but never declared in slot.h. Any translation unit calling them without seeing a proper prototype would fall back to implicit int return (32 bits), truncating 64-bit pointers and causing SIGSEGV on dereference. This affected framecache.c (POST /slots → fc_slot_create, DELETE → fc_slot_destroy) and other callers. --- services/framecache/src/slot.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/services/framecache/src/slot.h b/services/framecache/src/slot.h index 32ee54f..a1bfde0 100644 --- a/services/framecache/src/slot.h +++ b/services/framecache/src/slot.h @@ -68,6 +68,19 @@ typedef struct { _Static_assert(sizeof(fc_frame_t) == FC_FRAME_HDR_SIZE, "fc_frame_t header must be exactly FC_FRAME_HDR_SIZE bytes"); +/* Function declarations */ +struct fc_slot *fc_slot_create(const char *slot_id, + uint32_t width, uint32_t height, + uint32_t fps_num, uint32_t fps_den, + uint32_t pixel_format, + const char *source_type); +void fc_slot_destroy(struct fc_slot *s); +struct fc_slot *fc_slot_open(const char *slot_id); +void fc_slot_close(struct fc_slot *s); +void fc_slot_write_frame(struct fc_slot *s, + const uint8_t *data, uint32_t size, + uint64_t pts_us); + /* Accessor functions — inline now that struct fc_slot is defined above */ static inline fc_header_t *fc_slot_header(struct fc_slot *s) { return (fc_header_t *)s->base; } static inline const char *fc_slot_id(struct fc_slot *s) { return s->slot_id; }