summaryrefslogtreecommitdiff
path: root/15/f4fa202b2e64786a698d31fe0084c878c59dcd
blob: 1074a09c644bd9e0274480d037108f311691053d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
Delivery-date: Mon, 02 Sep 2024 16:20:45 -0700
Received: from mail-oo1-f63.google.com ([209.85.161.63])
	by mail.fairlystable.org with esmtps  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
	(Exim 4.94.2)
	(envelope-from <bitcoindev+bncBAABBREQ3G3AMGQECZS4SHA@googlegroups.com>)
	id 1slGLl-0006xs-6n
	for bitcoindev@gnusha.org; Mon, 02 Sep 2024 16:20:45 -0700
Received: by mail-oo1-f63.google.com with SMTP id 006d021491bc7-5df9ac3042dsf4912434eaf.2
        for <bitcoindev@gnusha.org>; Mon, 02 Sep 2024 16:20:44 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1725319239; cv=pass;
        d=google.com; s=arc-20240605;
        b=GNinJi8pB6nGcDQ5nW4YDGqk/K97FxhMzuu4tW1laKmjQlU2splDnyW58NMz4aqJcX
         WTzQfC1R34F2D8MeHp+lrngoK04U6MgRzjVjZKYiYMeYWDkGNlAPJSDATFVeIB1uDwsy
         eTxqe9sSwoiJkypjPSC4ggPwyj+LPVARpHqaQ+7b2PCRtrEH/SgOPPtJHhNg7DL+JqX2
         2tCxRTIbnk5GUY/p+Q6EDoTMZG3J7DGCXLROwQ2dSpfqUxrfxH0vexPf62qPq09i4cYf
         rRXwRFJluF3n7NT0rbZPTN/sX3VTgKfGRN1YcEXVbqbjOzkKTS8EVnl1RUx5epXxpEKv
         N+lQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:content-disposition:mime-version
         :message-id:subject:cc:to:from:date:feedback-id:sender
         :dkim-signature;
        bh=YDgsZBhOGQvj2To26vmKW30ghmsfaugkpWwMpTjrwxI=;
        fh=Hv+viPMrmmJu9MPCurYx+NHDcejr2rDqwmyn5wyI6LY=;
        b=fC4jbLWPXeu+LGMNssXLspog0tEgNCvFqnLHqD0YABxmJRZtw6vr6lKIGuXekDxJPV
         9FpppuFK5WFOuA7TDQlzfNHipvyVOffNG/ZhIyZYz4m4/vaP7sRKY1VHv0f0g/WdUG0m
         53KklJEtiBXKtDJ3QtsJrROn7kEWLiItSyY+CxWWELTt2qohKUSRCD6zN8DKsf1Dvijy
         g2x0CZsRNJm76T4wwC/UV9sPk1GFxW+fMQEHX+N/sMUxLCK7AFDRTeFMh1AJ2s0cDzRt
         IXhu55eaZ4QAzmOEqhGr+FEFNGi8bHxyJvW8Va+aD3Uc69Hq5hXNplEzZunP8fiq77nE
         sHvg==;
        darn=gnusha.org
ARC-Authentication-Results: i=2; gmr-mx.google.com;
       dkim=pass header.i=@tobin.cc header.s=fm3 header.b=ZGVPTH2z;
       dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=NJrXPhnX;
       spf=pass (google.com: domain of me@tobin.cc designates 103.168.172.159 as permitted sender) smtp.mailfrom=me@tobin.cc;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tobin.cc
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlegroups.com; s=20230601; t=1725319239; x=1725924039; darn=gnusha.org;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-authentication-results
         :x-original-sender:content-disposition:mime-version:message-id
         :subject:cc:to:from:date:feedback-id:sender:from:to:cc:subject:date
         :message-id:reply-to;
        bh=YDgsZBhOGQvj2To26vmKW30ghmsfaugkpWwMpTjrwxI=;
        b=Yl9G35APBfI0qRDECCjDQ5JLoYBc5suL8TjXbEf/CpLujknhmUpnTkeTg9+nl7e9Bc
         /zeK4ms/QK4+LkCnO/+LMBoBE7ZgNu5zKJ/KWVqCZplExeebt56iVs8Ywl5Lxh/4mAds
         GxwM84pF9mQgaP4m+i9FNXKkBLr3OxYk+iYebx8DofRi07OEQuN9Y5y77Z8IOqfi1ObO
         7Jo7NaGsZOITrsz2HkLB1Sc6z6PFNOkNNqqot8yM/WwSXvawCl+KPNgL8OKcddKQ1bzo
         FJddXC22655OB4+5yBMaHzT29gA6llMOErO20XkfA0C7tO7lP/Bn1bnYc4uVg711Onei
         V3Xg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1725319239; x=1725924039;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-authentication-results
         :x-original-sender:content-disposition:mime-version:message-id
         :subject:cc:to:from:date:feedback-id:x-beenthere:x-gm-message-state
         :sender:from:to:cc:subject:date:message-id:reply-to;
        bh=YDgsZBhOGQvj2To26vmKW30ghmsfaugkpWwMpTjrwxI=;
        b=AOabjPwkl808vrlGAkk2QRwi1La/6kdqcC3e76yis6h3LoQWI/CJCXeNyzCwGIumsW
         wa/sJQvHzMBfNlGKbxU07X8jNojZ5oWNoYlqPuGpjkFYLubrjqg7arvzomYC0OHTIcPt
         0+GuVRd17oTdtSOedPjCeqPeYqxW4zoi+SGLrCqrTLLDZw4YyTvqNnWw8N9VYQEbCwRt
         J/InpFDyDBFB5d0zRoJVwQuPWIVOUDziozLoJ2B45LeafwF6LLHMGB3YoixyhNvPcLtt
         +G+ZbJxsVPTkSKi1G04HpwkhQ1UHngMvMa5QIejUNDuLsnkzdEFCkeZOfGHP11+5c4GK
         ERfQ==
Sender: bitcoindev@googlegroups.com
X-Forwarded-Encrypted: i=2; AJvYcCVtpcy/7li1zAnVyGq7ijrT/ls4THLLhfCtSzD2IM8QVZcYDFPHDUK3WGfy505H1ijiMeHvqyhva/xH@gnusha.org
X-Gm-Message-State: AOJu0Yw4evlp1UwVsGhw4aHZcBrEGrdseYJbv81yitcP7QB443E7hlVT
	t/wj2TX+gtILO/NmzFgE9Edp0DhotT9KSYrTec7Las8W1cdZFlkP
X-Google-Smtp-Source: AGHT+IHT6S4rVCmWxaWevPjhtiIg2StrJXDOlGYOAsLLXm5CZMfqHsjJDh5fSlNuWgt8qs70NJuHsQ==
X-Received: by 2002:a05:6820:2297:b0:5dc:9800:a443 with SMTP id 006d021491bc7-5dfacddf48fmr13551595eaf.1.1725319238832;
        Mon, 02 Sep 2024 16:20:38 -0700 (PDT)
X-BeenThere: bitcoindev@googlegroups.com
Received: by 2002:a4a:e643:0:b0:5df:8190:e5d9 with SMTP id 006d021491bc7-5df98dbe205ls4854148eaf.0.-pod-prod-07-us;
 Mon, 02 Sep 2024 16:20:36 -0700 (PDT)
X-Received: by 2002:a05:6808:22a5:b0:3df:c96:ebc4 with SMTP id 5614622812f47-3df1c942cfamr11319968b6e.6.1725319236678;
        Mon, 02 Sep 2024 16:20:36 -0700 (PDT)
Received: by 2002:a05:6808:8cb:b0:3df:373:4881 with SMTP id 5614622812f47-3df116032cbmsb6e;
        Mon, 2 Sep 2024 16:18:12 -0700 (PDT)
X-Received: by 2002:a05:6808:1442:b0:3df:16db:8b9e with SMTP id 5614622812f47-3df1c95d85amr11112717b6e.11.1725319091413;
        Mon, 02 Sep 2024 16:18:11 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1725319091; cv=none;
        d=google.com; s=arc-20240605;
        b=HrlLfP2JpQlGpWH9qySd/Jd/rBHknYzU/+iMnwWalImK95BMsxh26fxbVnpTmg0FSe
         jIfWYpTZadZ3P066eUVChw/gFYUI6qmwUw1S+IWpUWMJPJXzaKx0Go4rY5xEUWfIyFMn
         HOUA4IUGzzFygmxHWoRLvIkaOVQpy8IW5gA66qfIeKRjtsdP1c/OVVKxaItTUJIogLxd
         7PpDIgkfl/i12x0ptK8OZE80ga2iysXIaQfLI24qavYdRNChSwB81d+X8a5Ek0XyrBNq
         HzE+sMp6sZ4yOFWt375KsZCJH0TYE5fsNcS9Wf/tpbWUgydEu+u5jZdzeib8hU8MMPiA
         YdbA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605;
        h=content-disposition:mime-version:message-id:subject:cc:to:from:date
         :feedback-id:dkim-signature:dkim-signature;
        bh=4o6t0ACKcO8NiKXiJnVXYTv+GlnBR2IefU1nEK0i7ZM=;
        fh=htB4OprfBlnXyMypK6zjKViIJmpg/UrDOpADf2DI1NM=;
        b=OTSyW812hLM2h+XdJrKE2X+9N9WlDKydYmw+5oMpQMXozE5JmnlE30IZjfi/4Pb3xQ
         c6DIlzuh3Cly7iQaY6OxGcGkI6Kx6bM323+GbHrmmzVY8+To6iR5t/VYx0s+Tcv8XOHK
         95T2xiTH6FO4M5JxbyNRnf90HKmyeysR+FUWsRjS59LIZEBkyHvYLbR1D7wB7xqFqfzY
         pwyMlRXcsnK1lWR2Vbo8iQlhBnqGuQvBKY2YalqS8EgSXKo+sY9TIDfxTMOfDinamA7T
         9lmHmR0qS+8aHQP/u0feKiBGTgIly90keOMGHONmPd+wJrDTkDODZ4FaLXXDK0IyGa5D
         KalQ==;
        dara=google.com
ARC-Authentication-Results: i=1; gmr-mx.google.com;
       dkim=pass header.i=@tobin.cc header.s=fm3 header.b=ZGVPTH2z;
       dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=NJrXPhnX;
       spf=pass (google.com: domain of me@tobin.cc designates 103.168.172.159 as permitted sender) smtp.mailfrom=me@tobin.cc;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tobin.cc
Received: from fhigh8-smtp.messagingengine.com (fhigh8-smtp.messagingengine.com. [103.168.172.159])
        by gmr-mx.google.com with ESMTPS id 5614622812f47-3df11645128si404724b6e.0.2024.09.02.16.18.10
        for <bitcoindev@googlegroups.com>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 02 Sep 2024 16:18:11 -0700 (PDT)
Received-SPF: pass (google.com: domain of me@tobin.cc designates 103.168.172.159 as permitted sender) client-ip=103.168.172.159;
Received: from phl-compute-08.internal (phl-compute-08.nyi.internal [10.202.2.48])
	by mailfhigh.nyi.internal (Postfix) with ESMTP id 89B731140189;
	Mon,  2 Sep 2024 19:18:10 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
  by phl-compute-08.internal (MEProxy); Mon, 02 Sep 2024 19:18:10 -0400
X-ME-Sender: <xms:skfWZjJkROrDVu87Hi8U_ytYZUAG7rQgJvTvSEeUT_fPci3sz8nheg>
    <xme:skfWZnKxMTPCk1xCFcvs-jKL8Aea-ouGFVcPPTQw_Mze-M3pm8UdcqIIFAiVgVanh
    a5qvQ54g_wfTra1rQ>
X-ME-Received: <xmr:skfWZrtRDdqScWz0QBEX09kjMS06ttX0jvVfBK5dLg8Jvak1haBE2nL5HGcASZCGsIOh4RJaxM6jCLlS12iKRRVpGA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudehgedgvdduucetufdoteggodetrfdotf
    fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
    rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh
    htshculddquddttddmnegfrhhlucfvnfffucdlfedtmdenucfjughrpeffhffvvefukfgg
    tgguofesthdtredtredtvdenucfhrhhomhepvfhosghinhcujfgrrhguihhnghcuoehmvg
    esthhosghinhdrtggtqeenucggtffrrghtthgvrhhnpeeuleffudffveelfedtuedvgeeh
    vdelheejieejtdevtdelfeetkeefvefgjefftdenucevlhhushhtvghrufhiiigvpedtne
    curfgrrhgrmhepmhgrihhlfhhrohhmpehmvgesthhosghinhdrtggtpdhnsggprhgtphht
    thhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsihhttghoihhnuggvvh
    esghhoohhglhgvghhrohhuphhsrdgtohhmpdhrtghpthhtoheprghpohgvlhhsthhrrges
    fihpshhofhhtfigrrhgvrdhnvghtpdhrtghpthhtohepmhgrrhhtihhnrdhhrggsohhvsh
    htihgrkhesghhmrghilhdrtghomh
X-ME-Proxy: <xmx:skfWZsY6YZaHCBnsBATWNWvn2DzVy-xxBKdOXTX1JQas3QhFRb_egQ>
    <xmx:skfWZqau_4CPlQRIYBl740SAZNe0A1Up5SLdZl0LgobCGKC9cqeNRg>
    <xmx:skfWZgAdtRm-yLY1L0Ddh43vk7gqyybptcsnm6yFhC4AVeJMil7odA>
    <xmx:skfWZobqyNgMqqBw0Qg3gmrhBrhYZElg5iM6dqDsHp5RJ_oA51itFQ>
    <xmx:skfWZqEiBORoAqiRIrvMyJoub8rcyWTmzU5JM2epFn-7uBdvX7shkUVV>
Feedback-ID: i05c0407e:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 2 Sep 2024 19:18:09 -0400 (EDT)
Date: Tue, 3 Sep 2024 09:18:05 +1000
From: Tobin Harding <me@tobin.cc>
To: bitcoindev@googlegroups.com
Cc: Andrew Poelstra <apoelstra@wpsoftware.net>,
	Martin =?utf-8?Q?Habov=C5=A1tiak?= <martin.habovstiak@gmail.com>
Subject: [bitcoindev] ReadCompactSize without range check
Message-ID: <ZtZHrc3XvTXEvHf6@alke>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
X-Mailer: Mutt 2.1.4 (2021-12-11)
X-Original-Sender: me@tobin.cc
X-Original-Authentication-Results: gmr-mx.google.com;       dkim=pass
 header.i=@tobin.cc header.s=fm3 header.b=ZGVPTH2z;       dkim=pass
 header.i=@messagingengine.com header.s=fm1 header.b=NJrXPhnX;       spf=pass
 (google.com: domain of me@tobin.cc designates 103.168.172.159 as permitted
 sender) smtp.mailfrom=me@tobin.cc;       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tobin.cc
Precedence: list
Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com
List-ID: <bitcoindev.googlegroups.com>
X-Google-Group-Id: 786775582512
List-Post: <https://groups.google.com/group/bitcoindev/post>, <mailto:bitcoindev@googlegroups.com>
List-Help: <https://groups.google.com/support/>, <mailto:bitcoindev+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/bitcoindev
List-Subscribe: <https://groups.google.com/group/bitcoindev/subscribe>, <mailto:bitcoindev+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+786775582512+unsubscribe@googlegroups.com>,
 <https://groups.google.com/group/bitcoindev/subscribe>
X-Spam-Score: -0.8 (/)

Hi,

Context:

- The `ReadCompactSize` function takes an optional `range_check`
  parameter that defaults to `true` (see `serialize.h`).
- `range_check == true` enforces that the compact size value is less
  than 0x02000000 i.e., if fits within a 32 unsigned integer.
- Grepping the code base shows that `ReadCompactSize` is never called
  with `false`.

My question is please:

Is there any reason not use a 32 bit integer for a value encoded using
CompactSize and ignore the 0xFF/9-byte-encoding of a compact size all
together?

Thanks,
Tobin.

-- 
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bitcoindev/ZtZHrc3XvTXEvHf6%40alke.