12 Commits
Author SHA1 Message Date
Victor M. Alvarez 4369ca6a1b Fix endianness issues in macho module (#2041)
This is backward compatible change that affects the `magic` field. After this change the value in the `magic` field looks exactly as it looks in the file regardless of the endianness of the current platform, if the file starts with `CA FE BA BE` the value in magic is `0xCAFEBABE`, not `0xBEBAFECA` as it used to be in little-endian architectures.
2024-02-12 15:23:09 +01:00
Victor M. Alvarez e065be6716 Add test case for magic field in macho module.
This should confirm an issue with the endianness of `magic` field in big-endian platforms.
2024-01-30 21:32:02 +01:00
Hilko Bengen 71980e0e7c Tests: Set top_srcdir variable instead of changing directory (#1466) 2021-03-22 10:33:03 +01:00
Victor M. Alvarez e293b8929e Fix broken test. 2021-02-04 16:15:50 +01:00
Victor M. Alvarez a07ec0812d Fix regression introduced in 94299eee38. 2021-01-29 12:15:59 +01:00
Victor M. AlvarezandSimon Hardy-Francis cba6932759 Implement non-blocking API (#1428)
With this change the yr_scanner_scan_mem_blocks function can return ERROR_BLOCK_NOT_READY when the YR_MEMORY_BLOCK_ITERATOR that provides memory blocks to the function is not ready to return the next block. After this error the caller can retry the call to yr_scanner_scan_mem_blocks multiple times until the function succeeds or fails with some other error code.

Co-authored-by: Simon Hardy-Francis <[email protected]>
2020-12-24 10:46:09 +01:00
Victor M. Alvarez 0bce4bd74d Start using clang-format for formatting the code automatically. 2020-10-07 16:27:30 +02:00
Simon Hardy-Francis 0975ea7d30 Fix linux compiler warnings and refactor common test code (#1366) 2020-10-05 09:47:25 +02:00
Scott Knight 793fc55358 Create test case for uninitialized number_of_segments
The current Mach-O parsing code attempts to call macho_rva_to_offset
while parsing load commands and before it has set number_of_segments.
Since macho_rva_to_offset uses number_of_segments this can result
in it using a number_of_segments that is uninitialized and is just a random
large number. In turn yara runs a really long time.

This adds a test binary based on this post

https://codegolf.stackexchange.com/questions/102471/smallest-possible-runnable-mach-o-executable/154685#154685

It has two load commands. The first is a LC_UNIXTHREAD command and
the second is a LC_SEGMENT command. It's a valid 386 Mach-O binary.
It reproduces this error.
2020-05-11 09:02:06 +02:00
Victor M. Alvarez 2376ca49fd Automate Bazel build with Travis CI (#1124) 2019-09-04 18:42:11 +02:00
Hilko Bengen 83ab75a82c Make tests find external files if run from separate build directory (#930) 2018-08-08 18:07:51 +02:00
mbandzi 0c57f0bd66 Mach-O file format support (#617)
Add module for parsing Mach-O files.
2017-11-21 13:03:22 +01:00