Skip to content

Wrong algorithm for scanning for signatures? #57

@mspi21

Description

@mspi21

I have been working on a freecam for Fallen Order and took some inspiration from your project (it’s been very helpful!), but in the process I noticed this piece of code, which doesn’t really make sense to me:

https://github.com/coltonon/OpenGameCamera/blob/afadceb5a877ca841c246ae58ca9440e372d888a/OpenGameCamera/SigScan/SigScan.cpp#L112

How can this ever work? It seems like a classic instance of the “finding a substring in a string” problem:

consider the following signature:

[34 56 78

and this piece of memory:

34 56 34 56 78

as I understand it, your algorithm goes through bytes 0 and 1, stops at the third (2), says “this one doesn’t check out”, but instead of going back to byte 1 and then 2, it continues with byte 3, therefore never detecting the pattern and returning a null pointer.

I do apologize if I’m missing something. It just seems strange that a linear algorithm could find a sequence of bytes in memory (without any sort of alignment tricks going on).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions