diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-06-26 05:16:44 -0400 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-06-26 05:16:44 -0400 |
commit | bb60708ccc6292d772053b161149f3599d6ccf10 (patch) | |
tree | 06d43a88fc5aac50d4b30b39764fae0e0cef7b35 /spa | |
parent | 76956eb41c52b996cb1dbf6b40ca173b622301a9 (diff) |
pod: _builder_deref() always works with builder size
Diffstat (limited to 'spa')
-rw-r--r-- | spa/include/spa/pod/builder.h | 5 | ||||
-rw-r--r-- | spa/include/spa/pod/filter.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/spa/include/spa/pod/builder.h b/spa/include/spa/pod/builder.h index 9be8d3f3..240c53ca 100644 --- a/spa/include/spa/pod/builder.h +++ b/spa/include/spa/pod/builder.h @@ -87,8 +87,9 @@ static inline void spa_pod_builder_init(struct spa_pod_builder *builder, void *d } static inline struct spa_pod * -spa_pod_builder_deref(struct spa_pod_builder *builder, uint32_t offset, uint32_t size) +spa_pod_builder_deref(struct spa_pod_builder *builder, uint32_t offset) { + uint32_t size = builder->size; if (offset + 8 <= size) { struct spa_pod *pod = SPA_MEMBER(builder->data, offset, struct spa_pod); if (offset + SPA_POD_SIZE(pod) <= size) @@ -100,7 +101,7 @@ spa_pod_builder_deref(struct spa_pod_builder *builder, uint32_t offset, uint32_t static inline struct spa_pod * spa_pod_builder_frame(struct spa_pod_builder *builder, struct spa_pod_frame *frame) { - return spa_pod_builder_deref(builder, frame->offset, builder->size); + return spa_pod_builder_deref(builder, frame->offset); } static inline void diff --git a/spa/include/spa/pod/filter.h b/spa/include/spa/pod/filter.h index c6c0c501..dd2e9931 100644 --- a/spa/include/spa/pod/filter.h +++ b/spa/include/spa/pod/filter.h @@ -367,7 +367,7 @@ spa_pod_filter(struct spa_pod_builder *b, spa_pod_builder_reset(b, &state); } else - *result = (struct spa_pod*)spa_pod_builder_deref(b, state.offset, b->size); + *result = (struct spa_pod*)spa_pod_builder_deref(b, state.offset); return res; } |