Skip to content

Commit

Permalink
Decode fails when interest id flag is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Mar 28, 2024
1 parent b7d77e5 commit 0a3ac7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/zenoh-pico/protocol/definitions/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ typedef struct {
} _z_undecl_interest_t;
_z_undecl_interest_t _z_undecl_interest_null(void);

#define _Z_FLAG_INTEREST_ID (1 << 5)

typedef struct {
enum {
_Z_DECL_KEXPR,
Expand Down
6 changes: 5 additions & 1 deletion src/protocol/codec/declarations.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,13 @@ int8_t _z_undecl_interest_decode(_z_undecl_interest_t *decl, _z_zbuf_t *zbf, uin
return _z_undecl_trivial_decode(zbf, &decl->_ext_keyexpr, &decl->_id, header);
}
int8_t _z_declaration_decode(_z_declaration_t *decl, _z_zbuf_t *zbf) {
int8_t ret;
uint8_t header;
_Z_RETURN_IF_ERR(_z_uint8_decode(&header, zbf));
if (_Z_HAS_FLAG(header, _Z_FLAG_INTEREST_ID)) {
return _Z_ERR_MESSAGE_FLAG_UNEXPECTED;
}

int8_t ret;
switch (_Z_MID(header)) {
case _Z_DECL_KEXPR_MID: {
decl->_tag = _Z_DECL_KEXPR;
Expand Down

0 comments on commit 0a3ac7d

Please sign in to comment.