public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
* [bitcoindev] ReadCompactSize without range check
@ 2024-09-02 23:18 Tobin Harding
  0 siblings, 0 replies; only message in thread
From: Tobin Harding @ 2024-09-02 23:18 UTC (permalink / raw)
  To: bitcoindev; +Cc: Andrew Poelstra, Martin Habovštiak

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-02 23:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-02 23:18 [bitcoindev] ReadCompactSize without range check Tobin Harding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox