contrib/fuzz/fm1readmarkers_corpus.py
author Pulkit Goyal <7895pulkit@gmail.com>
Wed, 22 May 2019 02:59:48 +0530
changeset 42432 c767e655ffda
parent 41035 9f06cd72cccb
child 43076 2372284d9457
permissions -rw-r--r--
narrow: use narrow_widen wireproto command to widen in case of ellipses Few releases ago, we introduce narrow_widen wireproto command to be used to widen narrow repositories. Before this patch, that was used in non-ellipses cases only. In ellipses cases, we still do exchange.pull() which can pull more data than required. After this patch, the client will first check whether server supports doing ellipses widening using wireproto command or not by checking server's wireproto capability. If the server is upto date and support latest ellipses capability, we call the wireproto command. Otherwise we fallback to exchange.pull() like before. The compat code make sure that things works even if one of the client or server is old. The initial version of this patch does not had this compat code. It's added to help Google release things smoothly internally. I plan to drop the compat code before the upcoming major release. Due to change to wireproto command, the code looks a bit dirty, next patches will clean that up. Differential Revision: https://phab.mercurial-scm.org/D6436
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41027
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     1
from __future__ import absolute_import, print_function
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     2
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     3
import argparse
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     4
import zipfile
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     5
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     6
ap = argparse.ArgumentParser()
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     7
ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     8
args = ap.parse_args()
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
     9
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    10
with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    11
    zf.writestr(
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    12
        'smallish_obsstore',
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    13
        (
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    14
            # header: fm1readmarkers should start at offset 1, and
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    15
            # read until byte 597.
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    16
            '1\x00597\x00'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    17
            # body of obsstore file
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    18
            '\x01\x00\x00\x00vA\xd7\x02+C\x1a<)\x01,\x00\x00\x01\x03\x03\xe6'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    19
            '\x92\xde)x\x16\xd1Xph\xc7\xa7[\xe5\xe2\x1a\xab\x1e6e\xaf\xc2\xae'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    20
            '\xe7\xbc\x83\xe1\x88\xa5\xda\xce>O\xbd\x04\xe9\x03\xc4o\xeb\x03'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    21
            '\x01\t\x05\x04\x1fef18operationamenduserAugie Fackler <raf@duri'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    22
            'n42.com>\x00\x00\x00vA\xd7\x02-\x8aD\xaf-\x01,\x00\x00\x01\x03\x03'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    23
            '\x17*\xca\x8f\x9e}i\xe0i\xbb\xdf\x9fb\x03\xd2XG?\xd3h\x98\x89\x1a'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    24
            '=2\xeb\xc3\xc5<\xb3\x9e\xcc\x0e;#\xee\xc3\x10ux\x03\x01\t\x05\x04'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    25
            '\x1fef18operationamenduserAugie Fackler <raf@durin42.com>\x00\x00'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    26
            '\x00vA\xd7\x02Mn\xd9%\xea\x01,\x00\x00\x01\x03\x03\x98\x89\x1a='
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    27
            '2\xeb\xc3\xc5<\xb3\x9e\xcc\x0e;#\xee\xc3\x10ux\xe0*\xcaT\x86Z8J'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    28
            '\x85)\x97\xff7\xcc)\xc1\x7f\x19\x0c\x01\x03\x01\t\x05\x04\x1fef'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    29
            '18operationamenduserAugie Fackler <raf@durin42.com>\x00\x00\x00'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    30
            'yA\xd7\x02MtA\xbfj\x01,\x00\x00\x01\x03\x03\xe0*\xcaT\x86Z8J\x85'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    31
            ')\x97\xff7\xcc)\xc1\x7f\x19\x0c\x01\x00\x94\x01\xa9\n\xf80\x92\xa3'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    32
            'j\xc5X\xb1\xc9:\xd51\xb8*\xa9\x03\x01\t\x08\x04\x1fef11operatio'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    33
            'nhistedituserAugie Fackler <raf@durin42.com>\x00\x00\x00yA\xd7\x02'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    34
            'MtA\xd4\xe1\x01,\x00\x00\x01\x03\x03"\xa5\xcb\x86\xb6\xf4\xbaO\xa0'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    35
            'sH\xe7?\xcb\x9b\xc2n\xcfI\x9e\x14\xf0D\xf0!\x18DN\xcd\x97\x016\xa5'
6a951f535fee fuzz: new fuzzer for parsers.fm1readmarkers
Augie Fackler <augie@google.com>
parents:
diff changeset
    36
            '\xef\xa06\xcb\x884\x8a\x03\x01\t\x08\x04\x1fef14operationhisted'))