Wireshark-commits: [Wireshark-commits] master 353ad11: checkAPIs.pl: check for return/goto in TRY/C

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 10 Oct 2018 04:07:26 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=353ad11974a6a81dfdb35a4dea123efa7e2adebb
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

353ad11 by Peter Wu (peter@xxxxxxxxxxxxx):

    checkAPIs.pl: check for return/goto in TRY/CATCH blocks
    
    As documented in epan/exceptions.h, return/goto should never be used in
    a TRY/CATCH/FINALLY block as ENDTRY must be executed first. Additionally
    clamp the exit code since values larger than 255 will wrap around. Use a
    small value as shells typically use 128+signal for termination signals.
    
    Verified against packet-t125.c and ftype-protocol.c while they suffered
    from the return bug. Tested against packet-gssapi.c for lack of false
    positives (goto with labels within the function) and against:
    
        int main() {
            TRY {
                goto bar;
                goto omg;
                goto bar;
                goto barrie;
        barrie: ;
            } ENDTRY;
        bar: meh;
        }
    
    Change-Id: I44484add34e238e07a84fc2c74b69f50ba6dc3f3
    Ping-Bug: 15189
    Reviewed-on: https://code.wireshark.org/review/30097
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  d923114   T125: avoid returning from TRY/CATCH in dissect_t125_heur
     add  353ad11   checkAPIs.pl: check for return/goto in TRY/CATCH blocks


Summary of changes:
 tools/checkAPIs.pl | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)