On Oct 10, 2012, at 8:55 PM, wme...@wireshark.org wrote:

> http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=45462
> 
> User: wmeier
> Date: 2012/10/10 08:55 PM
> 
> Log:
> Change 'for (i=1; i<=n;...' to 'for (i=0; i<n; ...)'
> 
> Done on general principles altho none of the cases
> changed would have actually resulted in an infinite
> loop because a Bounds error would eventually occur.

Actually, this one:

    for(sid_number = 1; sid_number <= number_of_sids; sid_number++) {
      proto_tree_add_item(parameter_tree, hf_stream_reset_sid, parameter_tvb, 
sid_offset, SID_LENGTH, ENC_BIG_ENDIAN);
      sid_offset += SID_LENGTH;
    }

could conceivably *not* cause a bounds error, as it looks as if it'd be 
executed even if parameter_tree is null, in which case the 
proto_tree_add_item() calls will just return without fetching anything from the 
tvbuff.  (That's why the buildbot bug I fixed with a similar change only showed 
up when I ran TShark *without* -V - *with* -v, proto_tree_add_item() actually 
fetched data from the tvbuff and threw a bounds error when it went past the end 
of the packet, but without it (and without any display/read filter or color 
filter or anything else that required building a protocol tree or even just 
fetching protocol field values), nothing was fetched and no exceptions were 
thrown.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to