19 Commits
Author SHA1 Message Date
zeekayandGitHub f5236f52c6 security(buffer): bound ReadUintNSlice to prevent DoS via crafted Reader (#3)
ReadUint{16,32,64}Slice recurses on c[buffered:] without making progress
when the underlying Reader returns a partial Peek (buffered == 0) but no
error. An attacker-supplied wire prefix combined with a long destination
slice exhausts the goroutine stack on the destination chain.

Discovered by github.com/luxfi/warp/pulsar's FuzzPulseDeserialize
harness during the Mar-3 2026 PQ Consensus Architecture Freeze
(regression seed: testdata/fuzz/FuzzPulseDeserialize/ccdb090e0ca0007b).

Fix:
  - Replace recursion with an iterative loop (O(1) stack)
  - Detect zero-progress reads and return ErrZeroProgress
  - Add Read{Uint16,Uint32,Uint64}SliceBounded length-prefix-aware
    wrappers gated by MaxSliceLen() (default 1 MiB, configurable via
    LUX_LATTICE_MAX_UINT64_SLICE_LEN env var)
  - Regression tests for all three slice readers + happy path + bounded
    rejection
2026-05-29 20:31:16 -07:00
b7047e96b4 Update utils/buffer/reader.go
Co-authored-by: Boris Flesch <[email protected]>
2023-10-30 15:03:54 +01:00
5473c026f5 Update utils/buffer/reader.go
Co-authored-by: Boris Flesch <[email protected]>
2023-10-30 15:03:46 +01:00
4e8d944918 Update utils/buffer/reader.go
Co-authored-by: Boris Flesch <[email protected]>
2023-10-30 15:03:36 +01:00
Jean-Philippe Bossuat 1dc4d5eeca [gosec]: added small comments on nopsec exceptions 2023-10-13 14:38:42 +02:00
Jean-Philippe Bossuat da9c308ad7 [utils/structs]: expanded support for floats and integers. 2023-10-05 11:22:36 +02:00
Jean-Philippe Bossuat f8daaed7ea typo 2023-10-04 10:44:51 +02:00
Jean-Philippe Bossuat ef39ad3597 [utils/buffer]: added generics 2023-10-04 10:36:15 +02:00
Jean-Philippe Bossuat 551e93a886 [bignum]: added tests 2023-07-14 21:31:48 +02:00
Jean-Philippe Bossuat d88a6ef9d8 [buffer]: added wrapper with int64 counter 2023-07-14 20:21:22 +02:00
Jean-Philippe ccf04089a2 gofmt 2023-07-13 11:43:22 +02:00
Jean-Philippe Bossuat d0551c02fb [buffer]: fixed a few bugs and added float64 support 2023-07-13 00:46:53 +02:00
Jean-Philippe Bossuat 6186700065 [utils/buffer]: all custom methods returns the number of bytes written as int64 2023-07-12 09:42:11 +02:00
Christian Mouchet 87ad1387f9 improved the Writer/Reader-based serialization
The WriterTo and ReaderFrom standard interface should be sufficient for the serialization
of lattigo objects from their pointers. Other interfaces such as BinaryMarshaller should
be based on WriterTo. This is possible in an efficient way if the Writer and Reader interface
expose their internal buffer.
2023-06-12 13:52:43 +02:00
Jean-Philippe Bossuat 9456c7eb3d pass on drlwe, dbfv, dbgv, dckks 2023-04-01 14:28:13 +02:00
Jean-Philippe Bossuat 2695e11261 improved marshalling test 2023-03-31 20:55:00 +02:00
Jean-Philippe Bossuat 34636663ea gosec 2023-03-30 12:33:49 +02:00
Jean-Philippe Bossuat 9781e8f9f6 Added io.Writer and io.Reader 2023-03-24 14:33:45 +01:00
Jean-Philippe Bossuat 35c1af9dc9 [utils]: added subpacakges and updated Write/Read API 2023-03-21 10:44:10 +01:00