Commit Graph
823 Commits
Author SHA1 Message Date
Nick Cooke cda56777d8 Merge pull request #3 from firebase/nc.sec
build: secure CI workflows and remove unused poetry dependencies
2026-07-29 22:31:47 -04:00
Nick Cooke c08d9ff7db style: revert shellcheck formatting in set_version.sh to minimize diff with upstream 2026-07-29 15:15:25 -04:00
Nick Cooke b8f45c33bf build: remove unused poetry files and fix shellcheck warnings
Remove the `extra/poetry` directory to eliminate high-severity vulnerabilities
flagged in unused protobuf dependencies. Also remove the reference to it from
`tools/set_version.sh` and fix existing shellcheck warnings in the script.
2026-07-29 14:30:39 -04:00
Nick Cooke f93018e682 fix(ci): add read permissions and pin checkout actions
Add the missing `permissions: contents: read` configuration to workflows
and pin the `actions/checkout` step to a specific commit hash for security
consistency with other Firebase repositories.
2026-07-29 14:30:39 -04:00
Nick Cooke 3851d94a41 Merge pull request #2 from firebase/nc.xcode26.spm
fix: add explicit platform versions to Package.swift
2.30910.1
2026-06-09 12:28:04 -04:00
Nick Cooke b260e36301 fix: add explicit platform versions to Package.swift 2026-06-09 10:40:40 -04:00
Petteri Aimonen c87a41d5bd Update Python2 CI workflow to Ubuntu 20.04
GitHub no longer offers the Ubuntu 18.04 runner.
2024-02-17 15:09:28 +02:00
Petteri Aimonen b7e1104502 Publishing nanopb-0.3.9.10 2.30910.0 2024-02-16 11:02:38 +02:00
Nick Cooke 4aeaf5c2c8 [nanopb] Add Apple privacy manifest 2024-02-16 10:56:43 +02:00
Petteri Aimonen 819d0a2173 Publishing nanopb-0.3.9.9 2.30909.0 2022-04-23 19:47:37 +03:00
Petteri Aimonen 50e366d2c3 Fix clang undefined behavior sanitizer errors.
Signed and unsigned integer overflows, no actual consequences
but clean up the errors.

Backport of commits 6801500e23 and 69e02afb6e.
2022-04-22 21:46:07 +03:00
Petteri Aimonen 4c961421e1 Add GitHub workflow for basic tests on maintenance branch 2022-04-22 21:46:07 +03:00
Petteri Aimonen b6c6381949 Explicitly check for pItem == NULL to satisfy Xcode analyzer (#667, #674)
As far as I can tell, the logic above this line does work correctly and
calls `allocate_field()` in any case where iter->pData could point to pointer
to NULL. But the logic depends on PB_SIZE_MAX and other subtle points, which
may be why static analyzers complain. This commit makes it explicitly check
and error out.
2021-06-04 08:32:54 +03:00
Petteri Aimonen 7ee9ef9f62 Publishing nanopb-0.3.9.8 2.30908.0 2021-03-22 14:50:07 +02:00
Petteri Aimonen 4a375a5606 Fix invalid free() with oneof (#647)
Nanopb would call free() or realloc() on an invalid
(attacker controlled) pointer value when all the following
conditions are true:

- PB_ENABLE_MALLOC is defined at the compile time
- Message definition contains an oneof field, and the oneof
  contains at least one pointer type field and at least one
  non-pointer type field.
- Data being decoded first contains a non-pointer value for
  the oneof field, and later contains an overwriting pointer
  value.

Depending on message layout, the bug may not be exploitable in all
cases, but it is known to be exploitable at least with string and
bytes fields. Actual security impact will also depend on the heap
implementation used.
2021-03-20 09:59:09 +02:00
Petteri Aimonen 0aa1dab94a Add testcase for #647: invalid free with oneof 2021-03-20 09:55:28 +02:00
Petteri Aimonen afd9e83039 Expand alltypes test case for default values inside oneof (#635)
The 0.3 branch was not affected by this bug, but expanding the test case to cover it.
2021-02-03 17:32:46 +02:00
Paul Beusterien 57674cbc62 Don't generate lines with trailing spaces (#622) 2020-12-05 08:16:57 +02:00
niooss-ledger ba2e8c782c Backport "Verify stream size before allocating string / bytes." (#620)
The 0.4 branch contains commit 2519119bab ("Verify stream size before
allocating string / bytes."):

    This stops ridicuously large mallocs from getting through
    on length-limited streams or buffers. Typically you should
    also override realloc() to limit allocation size yourself
    if dealing with untrusted data in pointer mode, but this
    at least limits the potential denial-of-service attacks.

Backport this patch in 0.3 maintenance branch in order to make fuzzing
not crash as soon as the decoder tries to allocate a large buffer.
2020-12-03 18:02:43 +02:00
Petteri Aimonen c2d43e59d8 Publishing nanopb-0.3.9.7 0.3.9.7 2.30907.0 2020-11-25 13:44:58 +02:00
Petteri Aimonen 3302311832 Update changelog 2020-11-25 13:10:57 +02:00
Petteri Aimonen d6c69808d2 Include version number in generator verbose output 2020-11-25 13:06:54 +02:00
Petteri Aimonen 2db67de2e8 Fix unsigned enums not working correctly inside OneOf (#611)
Fixed also a few smaller issues where generator didn't consider
fields inside oneof for field name mangling.
2020-11-25 13:06:33 +02:00
Tim Gates f96d99fe55 docs: fix simple typo, specifing -> specifying (#614)
There is a small typo in pb_encode.h, spm_headers/nanopb/pb_encode.h.

Should read `specifying` rather than `specifing`.
2020-11-25 12:59:12 +02:00
L 4a979c0f59 Add '--version' option to nanopb_generator.py (#607) 2020-11-25 12:58:37 +02:00
Petteri Aimonen 4fe2359573 Fix memory leak with oneofs and PB_ENABLE_MALLOC (#615)
Nanopb would leak memory when all of the following conditions were true:
- PB_ENABLE_MALLOC is defined at the compile time
- Message definitions contains an oneof field,
  the oneof contains a static submessage, and
  the static submessage contains a pointer field.
- Data being decoded contains two values for the submessage.

The logic in pb_release_union_field would detect that the same
submessage occurs twice, and wouldn't release it because keeping
the old values is necessary to match the C++ library behavior
regarding message merges.

But then decode_static_field() would go to memset() the whole
submessage to zero, because it unconditionally assumed it to
be uninitialized memory. This would normally happen when the
contents of the union field is switched to a different oneof
item, instead of merging with the same one.

This commit changes it so that the field is memset() only when
`which_field` contains a different tag.
2020-11-25 11:40:51 +02:00
Petteri Aimonen d9d5dfd869 Expand mem_release testcase to cover submessage merge (#615)
This also covers the fairly rarely used behavior of protobuf C++
library regarding oneof merges: if an oneof submessage occurs
multiple times in a message, their contents are merged together.
This behavior was also previously broken in nanopb.
2020-11-25 11:40:51 +02:00
Paul Beusterien 8119dfe563 Fix iOS Build warning (#585) 2.30906.0 2020-09-13 18:17:09 +03:00
Paul Beusterien 3cfa21200e More seamless SwiftPM implementation (#567)
This update allows clients to share common syntax for nanopb imports/includes between CocoaPods and Swift Package Manager.

See example at firebase/firebase-ios-sdk#6165
2020-08-07 12:38:52 +03:00
Petteri Aimonen 4502555fd3 Publishing nanopb-0.3.9.6 nanopb-0.3.9.6 0.3.9.6 2020-06-23 10:30:00 +03:00
Paul Beusterien 84265e6861 Swift package manager (#549)
Add build rules for Swift package manager
2020-06-22 18:55:49 +03:00
Petteri Aimonen 63f8e5e494 Fix ImportError when using generator/protoc with Python 3 2020-06-22 15:03:45 +03:00
Petteri Aimonen 7b442354d0 Fix buffer overflow when encoding bytes with size set to 65535 (#547)
On platforms where size_t equals pb_size_t, for example AVR where both
are 16-bit, or x86 and ARM when PB_FIELD_32BIT is defined, the buffer size
checks in pb_write() and pb_enc_submessage can overflow if a bytes field
has size close to maximum size value. This causes read and write out of bounds.

This issue can cause a security vulnerability if the size of a bytes field
in the structure given to pb_encode() is untrusted. Note that pb_decode()
has correct bounds checking and will reject too large values.
2020-06-22 14:58:37 +03:00
Petteri Aimonen 0bf6bef725 Merge pull request #504 from LedgerHQ/maintenance_0.3
Regression test + fix for proto3 submessage improperly considered empty
2020-03-26 13:57:03 +02:00
Franck b233555f55 Regression test + fix for proto3 submessage improperly considered empty 2020-03-26 11:24:10 +01:00
Petteri Aimonen accfbbbd68 Avoid overflows in allocation for packed fields.
This will only occur with unlimited length streams, so it's kind-of
low impact. Such streams allow denial of service anyway.
nanopb-0.3.9.5 0.3.9.5
2020-02-02 11:00:04 +02:00
Petteri Aimonen c046e36149 Publishing nanopb-0.3.9.5 2020-02-01 20:10:30 +02:00
Petteri Aimonen aa9d0d1ca7 Fix invalid free() after failed realloc() (GHSA-gcx3-7m76-287p) 2020-02-01 19:18:00 +02:00
Petteri Aimonen ced3bb2478 Add workaround for avr-libc realloc() bug (#475) 2019-12-31 13:38:53 +02:00
Petteri Aimonen ddaa999787 Fix empty submessages getting encoded in proto3 mode (#395)
Repeated callback fields were being treated as "always present",
even if the callback pointer wasn't set.
2019-12-19 10:07:49 +02:00
Petteri Aimonen a2738568de Eh, removed wrong release on PyPI.. 2019-12-14 09:51:32 +02:00
Petteri Aimonen 1c642695e9 Further fix attempt for #461 2019-12-14 09:48:41 +02:00
Petteri Aimonen 29440cd9b9 Automatically rebuild nanopb_pb2.py 2019-12-14 09:48:05 +02:00
Petteri Aimonen e32e7c7ee2 Revert "Generate python-protobuf files for PyPI package (#461)"
This reverts commit 597c747e53.
2019-12-14 09:46:24 +02:00
Petteri Aimonen 597c747e53 Generate python-protobuf files for PyPI package (#461) 2019-12-14 09:42:46 +02:00
Joshua Salzedo 92de18fd4e Backported Python pip packaging rules. 2019-12-13 22:12:52 +02:00
Petteri Aimonen ba4e832488 Avoid compiler warning in bool cast (#440) 2019-10-16 21:02:59 +03:00
Petteri Aimonen 493adf3616 Publishing nanopb-0.3.9.4 nanopb-0.3.9.4 0.3.9.4 2019-10-13 15:06:05 +03:00
Petteri Aimonen 1d6f3f4d13 Update changelog 2019-10-13 15:05:30 +03:00
Pavol Rusnak 536fe50629 Add test for PB_ENCODE_ARRAYS_UNPACKED 2019-10-11 10:51:45 +03:00