<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/arti.git/crates/tor-bytes/src/reader.rs, branch arti-v1.1.12</title>
<subtitle>mirror of https://gitlab.torproject.org/tpo/core/arti
</subtitle>
<id>http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.1.12</id>
<link rel='self' href='http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.1.12'/>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/'/>
<updated>2023-05-25T18:48:57Z</updated>
<entry>
<title>tor-bytes: Remove use of arrayref</title>
<updated>2023-05-25T18:48:57Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-05-25T18:48:57Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=244ec5dce22179eff9f732e947ee0b2836ba9d48'/>
<id>urn:sha1:244ec5dce22179eff9f732e947ee0b2836ba9d48</id>
<content type='text'>
Part of #872: Now that const generics are in, we have better ways to
express converting slices into array-references.
</content>
</entry>
<entry>
<title>tor-bytes: defend against misuse of extract_n().</title>
<updated>2023-03-06T17:33:10Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-03-06T17:33:10Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=dab21bc6243a382e1881fe05e561686bf6c474a9'/>
<id>urn:sha1:dab21bc6243a382e1881fe05e561686bf6c474a9</id>
<content type='text'>
Previously, if somebody wrote this code, an attacker could easily
use it to cause an OOM panic:

```
let n = r.take_u64();
let items: Vec&lt;Foo&gt; = r.extract_n(n as usize)?;
```

The first line of defense here is not to write protocols like that:
we don't actually _have_ any 32-bit counters in our protocol
AFAICT.

The second line of defense is to pre-check `n` for reasonableness
before calling `extract_n`.

Here we add a third line of defense: whereas previously we would do
`Vec::with_capacity(n)` in `extract_n`, we now allocate an initial
capacity of `min(n, r.remaining())`.  This ensures that the size of
the allocation can't exceed the remaining length of the message,
which (for our cell types at least) should prevent it from
overflowing or running OOM.
</content>
</entry>
<entry>
<title>tor-bytes: Clarify that Cursor is not a good thing, and could be neater.</title>
<updated>2023-03-01T16:21:52Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-03-01T16:21:52Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=b36082255b47330dd1bc3b615c320869cc9bd76d'/>
<id>urn:sha1:b36082255b47330dd1bc3b615c320869cc9bd76d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>clarify results of misusing cursors</title>
<updated>2023-03-01T15:57:14Z</updated>
<author>
<name>Ian Jackson</name>
<email>iwj@torproject.org</email>
</author>
<published>2023-03-01T15:57:14Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=bab32c603844683352a230aa4c312a851262c54b'/>
<id>urn:sha1:bab32c603844683352a230aa4c312a851262c54b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-bytes: Add cursor functionality to Reader</title>
<updated>2023-02-28T16:23:44Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-02-27T19:33:45Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=0bf1ae70ba06b512c63f73b84d1b357baa4a65d9'/>
<id>urn:sha1:0bf1ae70ba06b512c63f73b84d1b357baa4a65d9</id>
<content type='text'>
We'll use this to implement signature and MAC checking for
EstablishIntro cells.
</content>
</entry>
<entry>
<title>tor-bytes: Avoid redundant allocation</title>
<updated>2022-10-25T14:24:42Z</updated>
<author>
<name>Emil Engler</name>
<email>me@emilengler.com</email>
</author>
<published>2022-10-25T14:24:42Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=362d822ee45f7840cca4ac169ccca0f3bc706e48'/>
<id>urn:sha1:362d822ee45f7840cca4ac169ccca0f3bc706e48</id>
<content type='text'>
See c489e1d9118edd842f80b76a636037524a45ee45
</content>
</entry>
<entry>
<title>tor-bytes: read_nested_*: rustfmt</title>
<updated>2022-06-10T11:30:22Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2022-06-10T11:30:22Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=03a19f3877c9ae5008f8a88caa978f8cd4aaf7d9'/>
<id>urn:sha1:03a19f3877c9ae5008f8a88caa978f8cd4aaf7d9</id>
<content type='text'>
I disagree with almost all of these layout decisions...
</content>
</entry>
<entry>
<title>tor-bytes: read_nested_*: Take a closure</title>
<updated>2022-06-10T11:27:00Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2022-06-09T17:31:38Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=8fe63b3192ba631644fee561bb4ec895f2ae8d09'/>
<id>urn:sha1:8fe63b3192ba631644fee561bb4ec895f2ae8d09</id>
<content type='text'>
This eliminates the possibility of writing the bug of failing to call
`should_be_exhausted`.

As per this discussion
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/572#note_2811464

Fixes #498
</content>
</entry>
<entry>
<title>Fix typos in docs and comments</title>
<updated>2022-06-09T16:08:56Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2022-06-09T14:13:10Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=a2c6bd08fe90653dbe7b5889ef11ec9eec4c5c96'/>
<id>urn:sha1:a2c6bd08fe90653dbe7b5889ef11ec9eec4c5c96</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-bytes: Provide nested readers</title>
<updated>2022-06-09T16:08:56Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2022-06-07T19:18:31Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=a6a48c3c280e6ae0d02b47e2b04ab64f5a962cb8'/>
<id>urn:sha1:a6a48c3c280e6ae0d02b47e2b04ab64f5a962cb8</id>
<content type='text'>
</content>
</entry>
</feed>
