Commit Graph

5210 Commits

Author SHA1 Message Date
Rot127 e3bc578d2c
Move debian package generation to a dispatch only workflow (#2543)
* Move deb package gen files int package/deb

* Fix basename check

* Make debian package generation dispatch only
2024-11-13 22:10:59 +08:00
billow abbf32b431
fix coverity (#2546)
- cid 514642

- cid 514643

- cid 514644

- cid 514645
2024-11-13 22:05:18 +08:00
billow 1ecfb5b042
xtensa: update to espressif/llvm-project (#2533) 2024-11-10 21:55:40 +08:00
Rot127 379e2a4114
Rename build arguments: (#2534)
- BUILD_SHARED_LIBS -> CAPSTONE_BUILD_SHARED_LIBS
- BUILD_STATIC_LIBS -> CAPSTONE_BUILD_STATIC_LIBS
- BUILD_STATIC_LIBS -> CAPSTONE_BUILD_STATIC_MSVC_RUNTIME
2024-11-09 15:05:30 +08:00
Andrew d7be5f9f9f
Change CI to create Debian Package to Release (#2521)
* Updating CI to create Debian package and version is assigned by tag
version. Also updating release CI to not use end-of-life workflows

* Clear up usage of static libraries.

- Python bindings only use the dynamic lib. But built and copied the static ones sometimes nonetheless.
- Add toggles to build only static, static/dyn or only dynamic.

---------

Co-authored-by: Rot127 <unisono@quyllur.org>
2024-11-04 20:32:53 +08:00
billow f6f967961b
tricore: fixes #2474 (#2523)
* tricore: fix auto-sync tricore

* tricore: fixes TriCoreGenCSMappingInsnName.inc

* tricore: fixes

* tricore: try fix ld.a SC

* tricore: fixes all

* Add TriCore to .github/workflows/auto-sync.yaml

* Add TriCore details tests(a15, d15, a10|sp)
2024-11-01 17:30:42 +08:00
Rot127 09f35961cb
This time actually fix big endian issue. (#2530) 2024-10-29 12:02:37 +08:00
Rot127 306d5716d8
Fix endianess issue during assignment. (#2528) 2024-10-28 16:12:25 +08:00
Rot127 2cfca35e2f
Add CC and VAS compatibility macros (#2525) 2024-10-25 21:38:33 +08:00
Rot127 32519c01ef
Fix stringop-truncation warning some compilers raise. (#2522) 2024-10-23 23:06:48 +08:00
Rot127 5026c2c4e9
Merge pull request #2507 from thestr4ng3r/no-varargs-aarch64
AArch64: Replace vararg add_cs_detail by multiple concrete functions
2024-10-22 13:11:33 +00:00
Rot127 cecb5ede74
Fix #2509. (#2510)
Compatibility headers should always include the header in the same dir.
2024-10-22 16:22:16 +08:00
billow f97e2705da
xtensa: Fix Branch Target (#2516)
* xtensa: Fix Branch Target

* auto-sync: fix byte pattern

* xtensa: add branch insn tests

* Revert "auto-sync: fix byte pattern"

This reverts commit cf8e870f776889514b69a2f25a376f62ab2b291c.
2024-10-22 16:20:37 +08:00
Florian Märkl 1d13a12fbc AArch64: Replace vararg add_cs_detail by multiple concrete functions
Fixes UB caused by various mismatches on how these arguments are passed
and read. This became visible when running on PowerPC hosts with e.g.
`cstool -d aarch64 204862f8`.
Apart from the UB fix, this is meant to be a pure refactor.

Partially addresses #2458
2024-10-21 22:03:00 +02:00
Florian Märkl 8b6185289b
Update libcyaml dependency in cstest to 1.4.2 (#2508) 2024-10-19 12:07:17 +08:00
Rot127 ea081286bc
Tricore EA calculation (#2504) 2024-10-19 12:05:02 +08:00
Florian Märkl 7db9a08091
Fix cstest build with Ninja (#2506) 2024-10-16 17:12:09 +08:00
Rot127 7624269929
Only trigger on released action. (#2497) 2024-10-10 15:12:19 +08:00
Rot127 981d648b28
Add hard asserts to all SStream functions and memset MCInst. (#2501) 2024-10-07 21:54:01 +08:00
Rot127 d667a62777
Update labeler with Xtensa and v6 files. (#2500) 2024-10-07 16:40:28 +08:00
Rot127 52b54ee32d
Fixing UB santizer, `LITBASE` and assert errors. (#2499) 2024-10-06 08:45:13 +08:00
Rot127 5bd05e3424
Remove irrelevant changes. (#2495) 2024-09-30 23:15:47 +08:00
Wu ChenXu c5955b9257
Update changelog for V6.0.0-Alpha1 (#2493)
* update version to v6-alpha1

* update bindings const values

* Update changelog for V6.0.0-Alpha1
2024-09-30 23:01:55 +08:00
Wu ChenXu a424e709e8
Be ready for V6-Alpha1 (#2492)
* update version to v6-alpha1

* update bindings const values
2024-09-30 22:48:08 +08:00
Rot127 235ba8e0f6
SystemZ fixes (#2488)
* Fix leaks

* Remove unnecessary new lines

* Add checks for actual buffer length before attempting reading it.
2024-09-30 17:32:19 +08:00
Rot127 5dffa75bdb
Fix LDR not assigning immediate as memory offset. (#2487)
See: https://github.com/capstone-engine/capstone/issues/2015#issuecomment-2373660217
2024-09-30 17:31:34 +08:00
billow 21f7bc85f9
Xtensa Support (#2380)
* Fix leaks

* Remove unnecessary new lines

* Add checks for actual buffer length before attempting reading it.

* Xtensa: add xtensa support

* Xtensa fixes

- fix MCExpr
- fix Xtensa_add_cs_detail
- add `add_cs_detail`
- add `MCExpr *MCOperand_getExpr(const MCOperand *MC)` `void printExpr(const MCExpr *E, SStream *O)`

autosync fix

- fix StreamOperation.py
- replace `report_fatal_error` with `CS_ASSERT`
- fix patch StreamOperation.py
- replace `assert` with `CS_ASSERT`
- fix AddCSDetail.py
- fix QualifiedIdentifier

* Xtensa fix

* Xtensa fix .py

* add Xtensa to the fuzzer

* Xtensa `LITBASE`: add a basic implementation

* Xtensa `LITBASE`: add a integration test

* Xtensa: fix cs_v6_release_guide.md

* Xtensa: fix `XTENSA_OP_GROUP_MEMOPERAND`

* Xtensa: fix

* Xtensa: fix Targets.py

* Use isUint and isInt all over Xtensa

* Add documentation about LITBASE functionality

* Fix typo

* Replace hard with Capstone assert

* Xtensa: fix arch_config.json

* Xtensa: fix

---------

Co-authored-by: Rot127 <unisono@quyllur.org>
2024-09-30 11:35:51 +08:00
Rot127 29d8773417
Several small fixups (#2489)
* Remove internal code from API

* Fix compatibility headers and test the generation of them

* Cancel all previous test workflows on new push.

* Add valgrind test
2024-09-30 11:33:31 +08:00
Rot127 a34901e919
Update sponsors and remove empty file. (#2485) 2024-09-25 15:35:29 +08:00
Giovanni 3120932d9e
Fix Coverity CID 509730: overflow before widen (#2486) 2024-09-25 15:34:48 +08:00
Rot127 1014864d3f
Rename CS_OPT_NO_BRANCH_OFFSET and corresponding flag to better name. (#2482) 2024-09-25 15:33:45 +08:00
Rot127 0c90fe13f5
Replace `assert` with `CS_ASSERT` in modules (#2478)
* Replace asserts with macros for AArch64, Alpha, LoongArch, Mips, SystemZ inc files.

* Add missing clearing of MCInst

* Ensure correct dir name is used.

* Replace asserts in inc files for PPC, ARM, TriCore

* Replace all asserts in modules with CS_ASSERT.

Also enable the CS_ASSERTs if CMAKE_BUILD_TYPE=Debug

* Formatting
2024-09-25 14:58:06 +08:00
Rot127 823bfd53e3
AArch64 issues (#2473)
* Fix Pn was printed as register, not predicate.

* Fix: is_alias must be an int to allow for -1 as false.

* Fix, shift immediate was casted to incorrect width.

* Store theexact float also in fp field for convenience.

* Fix: MRS has no implicit write of NCVZ

* Fix signs of Imm8 shifted operands.

* Fix another MRS test

* Fix: Src operand of CASAL had write flag set.

* Fix sysop access in Python data structures.
2024-09-24 12:32:10 +08:00
Rot127 5430745e96
ARM fixes (#2477)
* Fix #2381

* Fix #2382

* Fix post-index correction only for pop with single register

* Fix missing memory index register scale

* Remove faulty and duplicated lshift field.

* Add shift information to shift alias instructions and add several tests.

* Fix scale tests

---------

Co-authored-by: Wu ChenXu <kabeor00@gmail.com>
2024-09-23 11:30:33 +08:00
Rot127 40dffb2668
Documentation updates (#2476)
* Remove Windows msvc project files and move build instructions to single BUILDING.md file.

* Move HACK.txt to Contributing and update it.

* Add refactoring guide.

* Add known bugs

* Remove compatibility headers.

* Fix smaller issues.

* Remove 'possible revert' column. People always can do manual changes.

* Move instruction alias description to the top

* Add table to general breaking changes.

* Update general release guide with the newest information.

* Highlight NanoMips and be more precise in writing.

* Add note about archs without alias.

* Add sentence about what is planned.

* Small corrections for Windows build instructions and debug macros.

* Fix rebase issues.

* Bring back make.sh for the CI
2024-09-23 11:26:56 +08:00
Giovanni e9b9b649cd
Fix jumps and branches on a non-zero PC (#2479)
* Fix ASAN shift runtime check

* Fix jumps and branches addresses when applying a PC address

* Add tests for branches and jumps
2024-09-19 22:41:46 +08:00
david942j 10db5f4f8c
[next][SuperH] Fix missing setting detail->sh (#2466)
* [next][SuperH] Fix missing setting detail->sh

detail->sh is never set. Which makes the detailed output related to operands is always missing.

Signed-off-by: david942j <david942j@gmail.com>

* Fix merge commit

---------

Signed-off-by: david942j <david942j@gmail.com>
2024-09-19 19:03:29 +08:00
Lucas Azevedo 67d975662e
[next] SH: Use bitwise OR with mask for sign extension (#2389)
* Use bitwise OR with mask for sign extension

Sign extend using bitwise OR with mask, instead of unary minus.
Fixes error when building for UWP with Security Development Lifecycle (SDL).
See https://learn.microsoft.com/en-us/cpp/build/reference/sdl-enable-additional-security-checks?view=msvc-170

* Remove unused store

Remove unused store caught by clang-tidy.

* Suppress clang-tidy false positive

Ignore an unitialized va_list false positive emitted by clang-tidy

---------

Co-authored-by: Wu ChenXu <kabeor00@gmail.com>
2024-09-19 01:09:54 +08:00
Rot127 3a2cd3c331
Coverity defects (#2469)
* Fix CID 508418 - Uninitialized struct

* Fix CID 509089 - Fix OOB read and write

* Fix CID 509088 - OOB.

Also adds tests and to ensure no OOB access.

* Fix CID 509085 - Resource leak.

* Fix CID 508414 and companions - Using undefined values.

* Fix CID 508405 - Use of uninitialized value

* Remove unnecessary and badly implemented dev fuzz code.

* Fix CID 508396 - Uninitialzied variable.

* Fix CID 508393, 508365 -- OOB read.

* Fix CID 432207 - OVerlapping memory access.

* Remove unused functions

* Fix CID 432170 - Overlapping memory access.

* Fix CID 166022 - Check for negative index

* Let strncat not depend n src operand.

* Fix 509083 and 509084 - NULL dereference

* Remove duplicated code.

* Initialize sysop

* Fix resource leak

* Remove unreachable code.

* Remove duplicate code.

* Add assert to check return value of cmoack

* Fixed: d should be a signed value, since it is checked against < 0

* Add missing break.

* Add NULL check

* Fix signs of binary search comparisons.

* Add explicit cast of or result

* Fix correct scope of case.

* Handle invalid integer type.

* Return UINT_MAX instead of implicitly casted -1

* Remove dead code

* Fix type of im

* Fix type of d

* Remove duplicated code.

* Add returns after CS_ASSERTS

* Check for len == 0 case.

* Ensure shift operates on uint64

* Replace strcpy with strncpy.

* Handle edge cases for 32bit rotate

* Fix some out of enum warnings

* Replace a strcpy with strncpy.

* Fix increment of address

* Skip some linting

* Fix: set instruction id

* Remove unused enum

* Replace the last usages of strcpy with SStream functions.

* Increase number of allowed AArch64 operands.

* Check safety of incrementing t the next operand.

* Fix naming of operand

* Update python constants

* Fix option setup of CS_OPT_DETAIL_REAL

* Document DETAIL_REAL has to be used with CS_OPT_ON.

* Run Coverity scan every Monday.

* Remove dead code

* Fix OOB read

* Rename macro to reflect it is only used with sstreams

* Fix rebase issues
2024-09-18 21:19:42 +08:00
Rot127 af1ed2fb3d
SystemZ Auto-Sync refactor (#2462) 2024-09-14 16:57:54 +08:00
Giovanni 6a7fef60ea
Auto-Sync Mips (#2410) 2024-09-07 22:30:47 +08:00
Giovanni e6da49d549
Some small fixes for capstone-next (#2460) 2024-09-03 09:22:47 +08:00
Rot127 191db14531
Modern Testing (#2456) 2024-08-31 21:33:38 +08:00
Rot127 df72286749
Use any-glob for labeler. Otherwise it is not checked recursively. (#2450) 2024-08-19 16:33:37 +08:00
Rot127 42d3acf5ec
[next] Wheel build fixes: manylinux1, trigger upload on release, Linux AArch64... (#2444)
* Add AArch64 linux build again.

* Enable package build also for PRs and pushes.

* Fix: don't append python version to injected platform name.

* Add musllinux build to wheel checking script

* Trigger wheel upload only on published full-releases.

* Remove duplicate workflow file

* Ensure all artifacts are moved to the same directory 'dist'

* Enable verbose twine upload.

* Add step to show downloaded artifacts for debugging.
2024-08-19 16:33:08 +08:00
Rot127 7149ec8dca
Update and add labels (#2446) 2024-08-19 10:52:41 +08:00
Mario Haustein 78eee139f4
Fix 'make check' for python tests (#2439) 2024-08-19 10:50:29 +08:00
Duncan Ogilvie f38d56b692
Add back support for relocatable packages (#2431) 2024-08-17 23:54:12 +08:00
Rot127 5e6807bab9
[next] Updates and fixes to the Python wheel builder workflow (#2441) 2024-08-15 20:57:23 +08:00
Rot127 1f0087a7a2
Add Coverity workflow (#2437) 2024-08-13 12:25:50 +08:00