Ethereal-dev: [Ethereal-dev] [PATCH] Disallow negative slice lengths

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Graeme Hewson <ghewson@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 23 May 2004 20:42:47 +0100
Graeme Hewson wrote:
In the updated documentation for display filters, I say when talking about slices:

Lengths can be negative too, in which case they mean the same as a negative
end offset. Thus, the following are equivalent:

    frame[-4:2]  == 0.1
    frame[-4--3] == 0.1
    frame[-4:-3] == 0.1


Are negative slice lengths useful?  I would suggest not.

No replies to this, so here's a series of patches to disallow negative slice lengths and fix a few other things.

scanner.l
    Use gint32 instead of guint32 and strtol() instead of strtoul()
    for signed integers.

    Pathological slice specifications could cause Flex default rule
    to be invoked, echoing characters to stdout.
    Example: frame[0foo]==1

syntax-tree.h
syntax-tree.c
    Use gint32 instead of guint32 for node data.

semcheck.c
    Check slice lengths as well as offsets.  Disallow negative/zero
    lengths.

    Range on RHS of display filter expression wasn't being checked in
    every case.

ftypes.c
    Fix assertion failure when absolute value of negative slice
    offset > field length.

    Remove code for handling negative slice lengths.

ethereal-filter.pod.template
    Remove reference to negative slice lengths.

    Clean and polish.


Graeme Hewson

Attachment: dfilter.tar.gz
Description: application/gzip