Commit Graph
2499 Commits
Author SHA1 Message Date
andrey 9c3690d371 fix(PIFFT_float): correct plan entry size from 4 to 8
The float FFT plan generator wrote 8 ints per entry (indices +0..+7)
but declared entrysize=4, causing heap overwrite into the next entry
and incorrect plan array sizing.
2026-08-06 17:01:30 +03:00
andrey 288c1b3575 fix: Sender::tick accesses parent->diags_ without lock — data race / use-after-free 2026-08-06 17:01:30 +03:00
andrey f5cf06c200 fix: addDevice deletes read thread without stopAndWait — race on dev close/open 2026-08-06 17:01:30 +03:00
andrey 4f601a9408 fix: removeAllFilters holds lock during delete — move destructors outside lock scope 2026-08-06 17:01:30 +03:00
andrey c3491cbf6f fix: PISingleApplication TOCTOU — two shm reads replaced with single atomic read 2026-08-06 17:01:30 +03:00
andrey 96f0221051 fix: PIStreamPacker division by zero when max_packet_size is 0 2026-08-06 17:01:30 +03:00
andrey 9680bb2af8 fix: remove unreachable return false in PICrypt::verifySign()
fix picrypth
2026-08-06 17:01:30 +03:00
andrey cb5530c864 fix: writePipe loses data on partial write > PIPE_BUF 2026-08-06 17:01:30 +03:00
andrey 736acbd419 fix: interfaceAddress buffer overflow on long interface names 2026-08-06 17:01:30 +03:00
andrey 27ed1bc9a7 fix: SIOCGIFMTU passes int* instead of ifreq* (Android) 2026-08-06 17:01:30 +03:00
andrey 38253effc6 fix: SIOCGIFNETMASK reads ifr_addr instead of ifr_netmask 2026-08-06 17:01:30 +03:00
andrey 6d75d10ec8 fix: PICAN openDevice buffer overflow in ifr_name 2026-08-06 17:01:30 +03:00
andrey 449b210d4e add test for pisharedmemory 2026-08-06 17:01:30 +03:00
andrey 7dd3cb5ee4 small fixes 2026-08-06 17:01:30 +03:00
andrey 9d38731e1a Merge pull request 'Bugfixes 2' (#208) from bugfixes2 into master
Reviewed-on: #208
2026-08-05 23:26:37 +03:00
andrey 1ddec15b87 threadsafe fixes 2026-08-05 19:48:01 +03:00
andrey 3f293ebd65 fix(PIFileTransfer): validate file id before array access
processFile() accessed files_[id - 1] without validating id.
When id == 0 (from a crafted network packet), id - 1 = -1 caused
out-of-bounds access. Added bounds check: id must be in range
[1, files_.size()]. Stops receive and logs error on invalid id.
2026-08-05 17:39:38 +03:00
andrey 27a9f05d65 fix(PIProcess): handle fork() failure (return value -1)
fork() can return -1 on error (too many processes, out of memory).
The old code treated pid_ == -1 as a successful fork, entering the
parent branch and calling waitpid(-1, ...) which waits for ANY
child process. Added explicit check: close pipes, free memory,
and return on fork failure.
2026-08-05 17:39:38 +03:00
andrey 13a9a75f79 fix(PISerial): break infinite loop when readDevice returns <= 0
In the blocking read path (timeout_ms <= 0), the while loop had no
exit condition for readDevice() returning 0 (EOF) or -1 (error).
This caused an infinite busy-loop at 100% CPU. Added 'else break'
to exit the loop on read failure, matching the timeout branch
which already handles this case.
2026-08-05 17:39:37 +03:00
andrey b2e637ee2b fix(PIIOByteArray): advance pos by actual bytes read, not requested size
readDevice() did pos += size instead of pos += ret. The clamping
on the next line (pos = min(pos, data_->size_s())) masked the
issue in practice, but the semantics were wrong. Aligns with
writeDevice() which correctly uses pos += rs.size_s().
2026-08-05 17:39:37 +03:00
andrey 9cd56ab66c fix(PIEthernet): check open() return value with >= 0 instead of != 0
open() returns -1 on error. The check fd != 0 treated -1 as a
valid fd (since -1 != 0 is true), causing devctl(-1, ...) and
close(-1) on QNX. Fixed to fd >= 0.
2026-08-05 17:39:36 +03:00
andrey e05abf16b5 fix(PIWaitEvent): use -1 as pipe_fd sentinel instead of 0
File descriptor 0 is stdin (a valid fd). Using 0 as the 'not-open'
sentinel caused isCreate() to return false and destroy() to skip
close() when pipe() happened to allocate fds {0, 1} (e.g. in daemons
with closed stdio). POSIX convention: -1 = invalid fd.
2026-08-05 17:39:36 +03:00
andrey 6c5c4b73e0 fix(PIClientServer): delete PIEthernet when client_factory returns nullptr
When the custom client_factory() returned nullptr, the incoming
PIEthernet pointer was leaked. Matches existing pattern used in the
max_clients overflow branch.
2026-08-05 17:39:35 +03:00
andrey e89ae88f3a fix(PICAN): align socket handling with PIEthernet patterns
- Sentinel: sock = 0 → sock = -1 (0 is stdin, valid fd)
- openDevice(): close socket on ioctl/bind failure (resource leak)
- openDevice(): set O_NONBLOCK via fcntl after socket()
- openDevice(): check setsockopt() return value
- closeDevice(): call shutdown() before close(), reset sock to -1
- readDevice() / writeDevice(): guard against sock == -1
- Add missing #include <fcntl.h>
2026-08-05 17:39:35 +03:00
andrey 216109b8ed fix(PIString): initialize toChar() return value and fix operator+= OOB
- toChar(): char v was uninitialized, causing UB when
  sscanf fails to match (empty string). Initialize to 0.

- operator+=(PIConstChars): loop iterated l < d.size() instead of
  l < str.size(), reading past the end of str after d.enlarge().
  This is a heap buffer overread with undefined behavior.
2026-08-05 17:39:34 +03:00
peri4 ef560ccc96 Merge pull request 'PIP Bugfixes' (#207) from bugfixes into master
Reviewed-on: #207
2026-08-05 13:32:11 +03:00
andrey df93563931 version 2026-08-05 13:11:27 +03:00
andrey 3603f6df13 fix piwaitevent 2026-08-05 12:59:36 +03:00
andrey 427130e2ca fix 2 2026-08-05 12:48:40 +03:00
andrey 42dd5945dd review fixes 2026-08-05 12:46:43 +03:00
andrey ec98963347 Revert "fix select usage"
This reverts commit 9da2d4fdb3.
2026-08-05 12:45:46 +03:00
andrey dc69ebe5ae fix memleak in PIEthernet::interfaces for android 2026-08-05 12:06:03 +03:00
andrey 11d6f7b0db piethernet replace inet_ntoa by threadsafe inet_ntop 2026-08-05 12:05:09 +03:00
andrey c53f1d39aa fix piethernet blocking write return value 2026-08-05 12:03:56 +03:00
andrey 9da2d4fdb3 fix select usage 2026-08-05 12:03:22 +03:00
andrey 6f11eeb895 check PIBinaryStream negative size to fix memory overflow 2026-08-05 12:02:35 +03:00
andrey b0307e8323 fix piprocess set workdir 2026-08-05 12:01:36 +03:00
andrey a2f625292a piterminal nonzero exit code on fail 2026-08-05 12:00:59 +03:00
peri4 15277f8f32 PIPoint operators *=, /=, * and / now also with PIPoint 2026-06-04 11:18:28 +03:00
peri4 1689f560d5 version 5.8.0
very important performance fix for normalizeAngleDeg...() methods, now fixed-speed (no "while")
MQTT client release
2026-05-29 17:40:09 +03:00
peri4 afb4ae8126 MQTT ready to use
change subscription logic - now keep subscriptions independently from connecting state. No unregisters on disconnect, but resubscriptions on connect. So one-time subscription on app start and just connect() on lost connection - all subscriptions keeps
2026-05-29 09:56:29 +03:00
peri4 38d09e272c MQTT seems to work
1. subscribe now similar to HTTP server, with lambda
 2. subscribe topic syntax support all HTTP features as path arguments and wildcards
 3. event received() changed to receivedUnhandled() for unhandled messages (should never be called in proper work)
 4. internal logic got more complicated, several endpoints may be serviced by single MQTT topic, so nested Map used
2026-05-28 20:26:49 +03:00
andrey 236896fb0f Merge pull request 'Add parents (de)serialization in pip_cmg' (#206) from cmg_serialize_parents into master
Reviewed-on: #206
Reviewed-by: Пелипенко Иван <peri4ko@yandex.ru>
2026-05-27 16:38:47 +03:00
andrey 533f9cc640 parse only public inherited classes 2026-05-27 16:37:04 +03:00
andrey 7b5c5d939b Add parents (de)serialization in pip_cmg 2026-05-27 15:44:08 +03:00
peri4 cf67072bed add files 2026-05-26 21:38:00 +03:00
peri4 34b55de561 revert RequestFunction 2026-05-26 21:37:21 +03:00
peri4 a2093e24a6 detach PIHTTPServer::Endpoint to base struct PIHTTP::ServerEndpoint (private header), no functionality changes in HTTP server
Ready to implement this private base struct to MQTT client
2026-05-26 21:31:58 +03:00
peri4 a2e54c3694 android fix unknown -W 2026-05-08 16:17:56 +03:00
peri4 a90c486094 PIJSON::print (and toJSON()) now use "null" for unknown type, resulting valid JSON 2026-04-09 14:23:41 +03:00