Wireshark-commits: [Wireshark-commits] master 0ca65a6: Fix crash when using the "matches" operator

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Mon, 11 Feb 2019 05:08:59 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=0ca65a66f425c8beaa1af3deb3b84c2b16cffb55
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

0ca65a6 by Peter Wu (peter@xxxxxxxxxxxxx):

    Fix crash when using the "matches" operator on non-UTF-8 data
    
    GRegex is a thin wrapper around PCRE. Inputs (patterns and subjects) are
    assumed to be UTF-8 by default (unless G_REGEX_RAW is set). If the
    subject is not valid UTF-8, normally pcre_exec will immediately return a
    failure. However, as GLib sets PCRE_NO_UTF8_CHECK when G_REGEX_RAW is
    given, pcre_exec() will skip the safety check and crash instead.
    
    Fix this by always assuming raw byte patterns. Regression risk: patterns
    such as `ö.ï` will no longer match `öñï` since `ñ` is a multi-byte
    sequence. Patterns such as `(GET|POST) /` remain functional though.
    
    Bug: 14905
    Change-Id: I6450bb83f565d377f82a5dbb01690c5f49acd96f
    Reviewed-on: https://code.wireshark.org/review/31935
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  f2dc64e   CIP: Fix false positive expert info
     add  0ca65a6   Fix crash when using the "matches" operator on non-UTF-8 data


Summary of changes:
 epan/ftypes/ftype-bytes.c | 24 ------------------------
 epan/ftypes/ftype-pcre.c  | 38 ++++++++++----------------------------
 2 files changed, 10 insertions(+), 52 deletions(-)