Looking at the first one, my compiler doesn't seem to realise that compute_offset() will throw an exception rather than return a number without setting *offset_ptr
But when I look at e.g. BoundsError (which may be returned without setting *offset_ptr), it is #defined as 1 in epan/exceptions.h
Surely the returns in compute_offset() should be THROW() calls instead?
Martin
/home/martin/wireshark/epan/tvbuff.c: In function ‘tvb_captured_length_remaining’:
/home/martin/wireshark/epan/tvbuff.c:274:26: error: ‘abs_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
*rem_len = tvb->length - *offset_ptr;
^
/home/martin/wireshark/epan/tvbuff.c:499:8: note: ‘abs_offset’ was declared here
guint abs_offset, rem_length;
^
/home/martin/wireshark/epan/tvbuff.c: In function ‘tvb_bytes_exist’:
/home/martin/wireshark/epan/tvbuff.c:325:13: error: ‘abs_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
end_offset = *offset_ptr + *length_ptr;
^
/home/martin/wireshark/epan/tvbuff.c:550:8: note: ‘abs_offset’ was declared here
guint abs_offset, abs_length;
^
/home/martin/wireshark/epan/tvbuff.c: In function ‘tvb_offset_exists’:
/home/martin/wireshark/epan/tvbuff.c:675:5: error: ‘abs_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (abs_offset < tvb->length) {
^
/home/martin/wireshark/epan/tvbuff.c: In function ‘tvb_reported_length_remaining’:
/home/martin/wireshark/epan/tvbuff.c:704:31: error: ‘abs_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
return tvb->reported_length - abs_offset;