Commit Graph
100 Commits
Author SHA1 Message Date
andrey 3e72f4e533 fix(PIBitArray): guard pop_back() against empty array
pop_back() called resize(size_ - 1) without checking for empty.
On empty array, uint underflow produced UINT_MAX, causing
bytesInBits(UINT_MAX) overflow and subsequent OOB access.
pop_front() already had this guard; pop_back() was missing it.
2026-08-06 17:01:30 +03:00
andrey c3cd9496dd fix(PIVariant): add missing break in setValueFromString switch
Three complex type cases (pivComplexf, pivComplexd, pivComplexld)
lacked break statements, causing fallthrough to pivTime. Setting
a complex variant from string silently overwrote the value with
PITime::fromString(), corrupting the variant's type and data.
2026-08-06 17:01:30 +03:00
andrey ef8fdb30f4 fix(PISharedMemory): reset data and unlink on mmap failure
When mmap() returned MAP_FAILED, data stayed as (void*)-1, causing
subsequent read/write/close to pass the null guard and crash.
Now resets data=nullptr, and calls shm_unlink when owner=true to
avoid orphaned shared memory objects.
2026-08-06 17:01:30 +03:00
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
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
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
andrey d27e796595 Add forEach method to PIVector2D 2026-03-28 20:17:58 +03:00
andrey edb7189013 disable gmock build and remove obsolete tests 2026-03-21 13:31:29 +03:00
andrey 96c22e1184 move std function 2026-03-20 16:31:30 +03:00
andrey 4537e40832 Merge branch 'master' into pitimer_slot 2026-03-20 15:35:34 +03:00
andrey 6efe77a395 add move 2026-03-20 13:46:31 +03:00
andrey 6cfc4524f0 PITimer slot optimize 2026-03-20 13:19:55 +03:00
andrey a1be5be5a1 increase timeout and remove sleep 2026-03-18 15:01:17 +03:00
andrey 99c99c39c2 separate cmake opts for tests 2026-03-18 13:39:01 +03:00
andrey ba57aa0144 disable exceptions on win 2026-03-18 09:40:32 +03:00
andrey ccbf86f781 disable exeptions in cmake 2026-03-18 09:30:28 +03:00
andrey ac415ebbb6 revert can_unlock flag 2026-03-18 08:54:06 +03:00
andrey c02b627d47 some fixes
PIEthernet::listen
PIClientServer::Server::~Server
PISystemTime const sleep
ClientServer tests fast and stable
2026-03-17 20:14:22 +03:00
andrey 9dc1af921c more simplify Pointer 2026-03-17 19:18:44 +03:00
andrey e761625eab using recursive mutex 2026-03-17 19:14:14 +03:00
andrey 449978bda0 revert main and more tests 2026-03-17 19:07:01 +03:00
andrey fe01c353e6 simplify tests 2026-03-17 18:56:20 +03:00
andrey 9f57f0107e remove picout 2026-03-17 18:34:48 +03:00
andrey ac877f1024 fixes 2026-03-17 18:13:23 +03:00
andrey 8ccc05ee78 simplify piprotectedvariable 2026-03-17 17:33:27 +03:00
andrey 2798d7de9c fix gitignore 2026-03-17 09:33:10 +03:00
andrey 9588b48105 PIVector2D - add funcs, optimize, tests, fixes, doxygen (#194)
Reviewed-on: #194
Co-authored-by: andrey.bychkov <andrey@signalmodelling.ru>
Co-committed-by: andrey.bychkov <andrey@signalmodelling.ru>
2026-02-27 23:58:44 +03:00
andrey 1739836a18 fix pistatistic mean calc 2026-02-25 17:50:56 +03:00
andrey 7195734765 add more tests 2026-02-17 21:53:18 +03:00
andrey 8ecec6b914 add more funcs 2026-02-17 21:40:36 +03:00
andrey 9029bcf099 Vibecoding PIVector2D - add funcs and doc
Добавь в файл pivector2d.h комментарии для Doxygen ко всем классам и
всем функциям.
Комментарии должны быть в таком же стиле как в файле pivector.h.

Проанализируй функциональность классов pivector2d в файле pivector2d.h и
класс pivector в файле pivector.h и добавь недостающую функциональность
в pivector2d по аналогии с pivector.
2026-02-17 21:04:40 +03:00
andrey ce962bfb40 fix for new pip 2025-09-15 19:47:32 +03:00
andrey 1b3f72d429 add PISystemMonitor measurer signal 2025-08-14 15:57:42 +03:00
andrey 3426a3064e main doc 2025-08-13 22:35:43 +03:00
andrey a41379a40e doc 2025-08-13 22:29:44 +03:00
andrey 39266f8c3c try 3 2025-08-13 22:20:13 +03:00
andrey 3bcb778628 try 2 2025-08-13 22:17:04 +03:00
andrey 781b430c33 revert 2025-08-13 22:15:12 +03:00
andrey 0ac7ea3096 fix linux exit finished 2025-08-13 22:12:14 +03:00
andrey 3625afa783 fix tests 2025-08-13 19:50:47 +03:00
andrey 154cbd0160 read and write pipes 2025-08-13 19:18:02 +03:00
andrey d4254121b8 Merge branch 'master' into piprocess 2025-08-13 14:09:37 +03:00
andrey da30ae558f add process tests 2025-08-13 14:09:18 +03:00
andrey d9719a7a50 Merge branch 'order_3pl' into process_pipes 2025-08-13 11:26:56 +03:00
andrey bf63365370 fix some tests 2025-08-13 11:22:56 +03:00
andrey 64e142b8c6 fix warning tmpnam 2025-08-13 11:17:31 +03:00
andrey be2d3c197c order 3lp dirs 2025-08-13 11:17:00 +03:00
andrey 30c4f215a2 remove unused includes 2025-08-13 10:32:42 +03:00
andrey 6ffbbbe636 starting pipes 2025-08-12 21:44:50 +03:00
andrey d62599fb8e review fixes 2025-08-12 13:57:06 +03:00
andrey 7e371132ae pcre2 remove unused files 2025-08-12 11:49:33 +03:00
andrey 19daab173c version 4.7.4 2025-07-31 20:56:32 +03:00
andrey 19f8f522b3 Fix multi piprocess wait 2025-07-31 20:55:33 +03:00
andrey 905d39c07b fix clang format and clear flag for read process out\err 2025-07-30 11:28:26 +03:00
andrey 7b52f6d70d fix get mtu (#186)
Reviewed-on: #186
2025-06-26 10:52:36 +03:00
andrey 19fe33383a Fix cmake module path (#185)
Если в cmake передаётся кастомная папка с cmake-модулями, например в toolchain файле, то pip перестаёт добавлять ./cmake в путь поиска модулей. Это приводит к ошибке `can't find PIPMacros.cmake`. Не  очень понимаю зачем так было сделано, поэтому просто убрал условие пустого CMAKE_MODULE_PATH.

Reviewed-on: #185
Co-authored-by: andrey.bychkov <andrey@signalmodelling.ru>
Co-committed-by: andrey.bychkov <andrey@signalmodelling.ru>
2025-06-26 10:52:04 +03:00
andrey fe82c12d5b fix build 2024-11-16 14:53:04 +03:00
andrey d90c3f0991 Merge branch 'master' into pisteampackerconfig
# Conflicts:
#	libs/client_server/piclientserver_server.cpp
#	libs/crypt/picrypt.cpp
#	libs/io_utils/pistreampacker.cpp
#	main.cpp
2024-11-16 14:34:34 +03:00
andrey 315966504e fix picrypt and remove crypt_frag from PIStreamPacker 2024-10-20 18:03:25 +03:00
andrey ac8efc9f88 need fix PIPackedTCP 2024-10-18 19:00:39 +03:00
andrey 92a0a9356c refactoring PICrypt, add PIStreamPackerConfig, delete piclientserver_config 2024-10-18 18:59:20 +03:00
andrey d764171c82 Обновить libs/main/containers/pipair.h 2024-05-13 14:35:49 +03:00
andrey b14d30108a Optimization removeAll and removeWhere in PIVector and PIDeque (#180)
Reviewed-on: #180
Co-authored-by: Andrey Bychkov <andrey@signalmodelling.ru>
Co-committed-by: Andrey Bychkov <andrey@signalmodelling.ru>
2024-03-13 10:43:02 +03:00