Keysight / optee_fuzzer

This repository contains the code for a fuzzing prototype for the OP-TEE system call interface using AFL.
GNU General Public License v3.0
132 stars 36 forks source link

"error: corrupt patch at line 124 "when I applying a patch to the build system,an error occured. #7

Open ddwupup opened 3 years ago

ddwupup commented 3 years ago

$ git apply optee_fuzzer/patches/optee-3.3/build.diff optee_fuzzer/patches/optee-3.3/build.diff:37: trailing whitespace. echo "slink /lib/libsqlfs.so libsqlfs.so.1 755 0 0" >> $(fl); \ error: corrupt patch at line 124

why this problem occured and how can I solve it,please?

c01dkit commented 3 years ago

@ddwupup

You can add \ No newline at end of file at line 125( the tail of the file)

And, remove the extra whitespace at line 37

Then run git apply --ignore-space-change --ignore-whitespace ../afl-tee/patches/optee-3.3/build.diff in the "build" folder

bitwave commented 2 years ago

same happens for me with the other patches... Can these be updated or the patch base (agains which I can apply them) be specified? I used -b 3.3.0 for repo checkout

Resery commented 2 years ago

are u solved this problem ? i can't patch the optee_client and optee_os

ddwupup commented 2 years ago

@ddwupup

You can add \ No newline at end of file at line 125( the tail of the file)

And, remove the extra whitespace at line 37

Then run git apply --ignore-space-change --ignore-whitespace ../afl-tee/patches/optee-3.3/build.diff in the "build" folder

Thank you, I solved it by manually patch the fixed files according to the diffing files.

ddwupup commented 2 years ago

are u solved this problem ? i can't patch the optee_client and optee_os

You can try this way https://github.com/Riscure/optee_fuzzer/issues/7#issuecomment-896778249 If it doesn't work, you can try to patch the fixed files according to the diffing files, then complies the programs and debug. Good luck!

Resery commented 2 years ago

are u solved this problem ? i can't patch the optee_client and optee_os

You can try this way #7 (comment) If it doesn't work, you can try to patch the fixed files according to the diffing files, then complies the programs and debug. Good luck!

i tired i can patch the build but it doesn't working for optee_os and optee_client This is the erroe message: error: corrupt patch at line xxx

bitwave commented 2 years ago

For the optee_client.diff patch this command works git apply --recount --ignore-space-change --ignore-whitespace ../afl-tee/patches/optee-3.3/optee_client.diff it ignores the line counts in the patch headers, which are wrong.

bitwave commented 2 years ago

for optee_os.diff remove the line 1264. In the file to be patched, there is not an empty line. Therefore the patch fails. These with git apply --ignore-space-change --ignore-whitespace for the build patch, as mentioned earlier to apply all patches.

coderCK2 commented 1 year ago

For the optee_client.diff patch this command works git apply --recount --ignore-space-change --ignore-whitespace ../afl-tee/patches/optee-3.3/optee_client.diff it ignores the line counts in the patch headers, which are wrong.

Thank you for this. It was the combo of --recount and --ignore-space-change that got my particular issue resolved.