Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
50 most recent check-ins
|
2026-08-06
| ||
| 14:11 | Bound decoding explicitly per entry point rather than inferring the outermost value from full depth: the standalone streaming array and map codecs never nest, so each element looked outermost and was granted the whole size budget afresh. Every public entry now constructs its decoder or allowance per call, Decoder.BeginValue makes reuse across a sequence of values explicit, and the standalone codecs gain Limited variants. leaf check-in: 31a747ab2c user: matthew tags: trunk | |
| 13:00 | Decode for forwards compatibility: enums accept every value of their underlying type (encoding stays strict), and arrays and maps of zero-width elements no longer fail the buffer bounds check. A member added by a newer schema, or an array of empty structs, now decodes. check-in: 090747e657 user: matthew tags: trunk | |
| 10:45 | Minor fix for panic messages check-in: 5635eb5c02 user: matthew tags: trunk | |
|
2026-08-05
| ||
| 19:11 | Be more permissive around enums with duplicated values. check-in: 357f2d348e user: matthew tags: trunk | |
| 18:05 | More tests. check-in: fa1dabc4be user: matthew tags: trunk | |
| 17:38 | More fixes for more corner cases. check-in: 038ebf38b8 user: matthew tags: trunk | |
| 17:23 | More fixes check-in: 267349067c user: matthew tags: trunk | |
| 17:14 | Correct treatment of string opcodes. Previously this was wrongly treated as BigEndian. It's meant to be LittleEndian. Because this feature is rarely used, I've decided to make this breaking change. But this is a breaking change. check-in: 90f14121b7 user: matthew tags: trunk | |
| 17:03 | More fixes involving limits. check-in: 5a245d2c3d user: matthew tags: trunk | |
| 15:58 | Bound what decoding may allocate and how deeply it may nest Both figures come off the wire and neither was checked. Four bytes claiming 4,294,967,295 elements allocated 80MiB for an array of structs and 426MiB for a map, and at full width asked for 34GB, which Go reports as a fatal error rather than a panic: the process dies and cannot recover. Nesting had the same shape, twenty million levels exhausting the stack just as fatally. Decoding now runs against a runtime.Limits, defaulting to 64MiB and a depth of 100. The size is a budget spent across the whole value rather than a cap on any one allocation: an empty array costs four bytes on the wire and twenty four as a Go slice header, so bounding each allocation alone still let a nest of arrays multiply its input by the depth, four bytes reaching 24MiB. Every case above now allocates nothing. UnmarshalBebop and DecodeBebop keep their signatures and take the defaults. UnmarshalBebopLimited and DecodeBebopLimited take explicit limits; a field left at zero takes the default for it, and there is no value meaning no limit. BebopUnmarshalAt takes an allowance, so every generated package must be regenerated together. A depth limit only holds if it is threaded through every level, and a changed signature makes a half regenerated tree a compile error rather than a quiet gap. The streaming side needed no change, a Decoder already carrying state. Encoding is untouched and verified byte for byte against the previous encoder. Suites pass on amd64 and 386; running under 386 caught the resolution of an unlimited budget stopping at 2GiB, since removed along with the concept. check-in: f8c6945081 user: matthew tags: trunk | |
| 15:06 | Move byte arrays whole, and backpatch message lengths A byte[] was encoded and decoded an element at a time. A byte needs no conversion, so the run now moves in one copy or one ReadFull, through four new runtime helpers. For a 4K blob: marshal 1944ns -> 37ns, unmarshal 3049ns -> 449ns, streaming decode 31959ns -> 468ns, and encoding to a stream drops from 4097 Write calls to 2. int8[] keeps the per-element path, having no []int8 to []byte conversion short of unsafe. The buffer form also gains the BebopHasBytes check, so a truncated run is refused rather than half filled. EncodeString handed Write a []byte conversion of the string, which escapes and so allocated a copy of every string encoded. io.WriteString passes the string as it stands to a writer that takes one: 197ns and 1032B down to 27ns and 8B for a 1K string. BebopMarshalStringAt copies from the string directly. A message asked SizeBebop for its own length prefix after MarshalBebop had already walked the value to size the buffer, and again at every level of a nested one. The prefix is now backpatched: four bytes are set aside, the body written, and the length filled in from the offset reached. An eight deep chain goes 62ns -> 40ns, and the cost is linear in depth rather than worse. The prefix is now derived from what was written instead of being trusted to agree with it. The encoding is unchanged: output verified byte for byte against the previous encoder across nested messages, unions, maps and structs, on amd64 and 386. check-in: 16cf6be246 user: matthew tags: trunk | |
| 14:42 | Check length prefixes against the buffer before widening them A uint32 length taken off the wire was converted to an int and only then tested. Where an int is 32 bits that turns large lengths negative, so the bounds test in BebopUnmarshalStringAt passed when it should have failed and the slice expression ran off the front of the buffer. Lengths are now compared in uint64 by runtime.BebopHasBytes, before any widening. The same check on the union body found a worse bug, and one that is not 32 bit specific: skipping a member whose discriminator the schema does not know set offset to an end computed from an unchecked prefix, and the test that followed compared offset against that same end, so it always passed. A union of four declared bytes in a five byte buffer returned offset 9 and a nil error, and the caller read from there. The message body is now checked the same way, which also keeps its end arithmetic from overflowing. Truncated input reports io.ErrUnexpectedEOF rather than ErrBadLengthPrefix. Skipping an unknown member or field whose length the buffer can satisfy is unchanged. Two things stopped the tree building for a 32 bit target at all: an untyped math.MaxUint32 handed to Sprintf in NewOpcode, which is to say the generator has never compiled on one, and the same mistake in the date tests. Both now typed. The suite passes under GOARCH=386 as well as amd64, and arm builds. Arrays and maps still size their allocation from an unchecked length. check-in: 3b20ea6579 user: matthew tags: trunk | |
| 14:13 | Validate unions completely before we write any bytes to the output. check-in: 590958274d user: matthew tags: trunk | |
| 14:04 | Fix generated code for map values of custom types A map value decoded through a pointer method was written straight to dict[key], which cannot be addressed: map[K, V] with a struct, message or union V did not compile, and would not have assigned the decoded value even if it had. The value now lands in a local first, as the key already did. Two more compile failures found alongside: * An empty struct as a map value. The size template branched on the const size rather than on whether the size is const at all, so a constant size of zero read as "not constant" and left the loop's value variable unused. generateMaps already had the booleans. * A message with a string field. FieldSize emitted len(self.S), but a message's fields are pointers; it now takes isPtr, as EncodeField and MarshalField already did. Only strings were affected - ints, arrays, maps and custom types in messages were all fine, as were strings in structs and unions. New generator/test/maps fixture covers map values of every kind; it fails with five compile errors against the previous generator. check-in: 0a7219c7ce user: matthew tags: trunk | |
| 13:47 | Correct enum validation check-in: bcc1a2f577 user: matthew tags: trunk | |
| 13:40 | Fix dates much more. Whoops! check-in: 3329c6b709 user: matthew tags: trunk | |
| 13:26 | Correct date handling for large dates. check-in: 3d95d729e4 user: matthew tags: trunk | |
| 13:17 | Validate map key types check-in: 66e7a19175 user: matthew tags: trunk | |
| 12:58 | Detect and reject schemas which contain infinite recursion of types. check-in: f5a58f00cc user: matthew tags: trunk | |
| 12:43 | Unexport funcs which will never be used from foreign package. check-in: c4a978ad70 user: matthew tags: trunk | |
| 12:23 | Use the go formatter to format canonically the generated Go. check-in: 0ab7e11d75 user: matthew tags: trunk | |
| 12:12 | New parser tests check-in: 3fe45abe6e user: matthew tags: trunk | |
| 12:12 | Allow type names to start with predeclared type names. check-in: 88a294b2d1 user: matthew tags: trunk | |
|
2025-02-03
| ||
| 14:36 | Update deps, regenerate, tidy. check-in: 8fd9a90b00 user: matthew tags: trunk | |
|
2023-11-13
| ||
| 21:48 | Forgot to add the imports test a while ago... check-in: 2b23860665 user: matthew tags: trunk | |
| 18:34 | Create new branch named "mistake" closed check-in: ef3bc35a9e user: matthew tags: mistake | |
| 18:32 | Decided that using unsafe wasn't worth it. check-in: 92941ea8aa user: matthew tags: trunk | |
| 15:42 | Use unsafe operations when decoding ints. This is entirely safe, provided we're on a little endian architecture. check-in: 8be55ec1f5 user: matthew tags: trunk | |
| 14:45 | Add common bebop interface. check-in: 766c1dc6f4 user: matthew tags: trunk | |
|
2023-11-09
| ||
| 19:24 | Write a README check-in: a92af83691 user: matthew tags: trunk | |
|
2023-11-05
| ||
| 13:22 | That seems to be enough to make imports work. check-in: 9871891597 user: matthew tags: trunk | |
|
2023-10-25
| ||
| 13:30 | Work on supporting imports. This is WIP. check-in: 8c90ffe4a6 user: matthew tags: trunk | |
|
2023-10-22
| ||
| 16:18 | Remove generated code for empty messages. Also make better use of known constant sizes. check-in: 9a1f8b745e user: matthew tags: trunk | |
| 15:47 | Realised I'd not done the renaming consistently. I'd only done marshalling, not encoding/decoding. Also make sure encoding/marshalling of enums checks that the enum value is valid first. check-in: 6e314bb9e3 user: matthew tags: trunk | |
| 15:26 | Correct implementation of maps check-in: 86c3131fe4 user: matthew tags: trunk | |
| 15:16 | Refine naming again. Decided to group all Bebop-internal methods together - they start with "Bebop" now. Hopefully easier to work with. check-in: d7400a2043 user: matthew tags: trunk | |
| 09:49 | Add tests and fix implementation of opcodes check-in: 650ca28190 user: matthew tags: trunk | |
|
2023-10-08
| ||
| 22:20 | Be much more consistent about naming. Also add some basic comments to the generated code. check-in: 28ead8e923 user: matthew tags: trunk | |
|
2023-10-07
| ||
| 21:40 | Factor out common maths. check-in: 4fa7339643 user: matthew tags: trunk | |
| 20:14 | Add buffer length checks in Unmarshal check-in: 78c169ec9e user: matthew tags: trunk | |
| 19:07 | Add Marshal/Unmarshal support check-in: 52b957e0c5 user: matthew tags: trunk | |
|
2023-09-30
| ||
| 17:57 | Add tests for unions Make sure the union detects on encoding multiple-non-nil fields. Also allow empty structs, test for them, fix a bug. check-in: d0d98411a6 user: matthew tags: trunk | |
| 17:04 | Add tests for structs and messages Turns out Size calculation for strings was wrong. Fixed. check-in: efaef902d6 user: matthew tags: trunk | |
| 15:19 | Add tests for enums. And fix some stuff. check-in: a8f46e36c3 user: matthew tags: trunk | |
|
2023-09-23
| ||
| 21:29 | Add the first generate test Which required: 1. sorting out cmd line args. 2. correct mistakes with consts templates. 3. introduce int8 type properly - turned out this already existed in runtime encoders/decoders. But strictly it's not in the bebop "spec". 4. correct imports for generated code. check-in: 15741344d0 user: matthew tags: trunk | |
|
2023-09-22
| ||
| 11:37 | Make the encoder a little more fussy about checking for validity of dates. check-in: 6ad971d030 user: matthew tags: trunk | |
| 11:30 | Add tests for encoding+decoding basic types. check-in: d9a2ab1bbf user: matthew tags: trunk | |
|
2023-09-20
| ||
| 17:14 | Well in theory that's all the decoder done too. Going to need to write some tests... check-in: a210a0a6b0 user: matthew tags: trunk | |
|
2023-09-19
| ||
| 16:38 | Work-in-progress on decoder. check-in: cd7cde4da7 user: matthew tags: trunk | |
| 13:02 | Add Apache 2.0 license check-in: ba1ca52492 user: matthew tags: trunk | |