fixed. Invalid include order O:) the off_t had 4 bytes and ulong is 8.
[sbox-SDK_PC: ~/radare-20070407/src] > diff -u tsearch.c.orig tsearch.c
--- tsearch.c.orig 2007-04-07 18:36:23.000000000 +0200
+++ tsearch.c 2007-04-07 18:36:33.000000000 +0200
@@ -28,12 +28,12 @@
/x 01 02 03 04
*/
-#include <stdlib.h>
-#include <signal.h>
#include "main.h"
#include "utils.h"
#include "flags.h"
#include "binparse.h"
+#include <stdlib.h>
+#include <signal.h>
void search_alarm()
{
[sbox-SDK_PC: ~/radare-20070407/src] >
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> tsearch line 142:
>>
>> for(radare_read(0);!config.interrupted;i = radare_read(1)) {
>> if (!i) break;
>> binparse_reset_tlist ( t ) ;
>> for(i=0;i<config.block_size;i++)
>> update_tlist(t, config.block[i], config.seek+i);
>>
>> config.seek += config.block_size;
>> }
>> config.seek = tmp;
>
> this is not ok, config.seek is incremented inside radare_read(1);
> // '1' means 'next block'.
>
>> and binparse.h :
>>
>> void binparse_reset_tlist (tokenizer *t );
>>
>> binparse.c :
>>
>> void binparse_reset_tlist (tokenizer *t )
>> {
>> int i,j;
>> for (i=0; i < t->nlists ; i ++ )
>> {
>> t->tls[i]->estat = 0;
>> }
>> }
>>
>>
>> in callback I've added the size of the search:
>> static void radare_tsearch_callback(struct _tokenizer *t, int i,
>> unsigned long long where, unsigned long long size)
>> {
>
> this is not ok, the block size is size_t, btw changing the block
> size does not fixes anything, it just reduces the visibility of the
> bytes near the hit. It's useful.
>
> Try printf'g the values from the callback hit will fix this issue, btw
> i was able to reproduce the bug on qemu-arm. I've no gdb there, but
> printf debugging will be enought to allow me to fix this.
>
> I think that passing more than one arg to a callback is not safe without
> using trampoline libraries or similar tricks. So I'll prefer to construct
> a single structure containing the arguments. This will fix the bug.
>
> Let me try! :)
>
> --pancake
>
> _______________________________________________
> radare mailing list
> [email protected]
> https://lists.nopcode.org/mailman/listinfo/radare
>
>
_______________________________________________
radare mailing list
[email protected]
https://lists.nopcode.org/mailman/listinfo/radare