<div dir="ltr">The patch does reduce false positives, but... it doesn't work very well, does it? It no longer prints "binary" or "ASCII" or "dictionary", except by accident.<br><br>It's trying to look back at the start of the file after looking at the end of the file, but that fails, because looking at the end of the file changes what offset "0" means.<br><br>This could be fixed with the new "OFFPOSITIVE" feature. I didn't test this, but I think you can just change each ">>0 use ttcomp-display" line to be ">>+0 use ttcomp-display". Though this will not work in any released version (5.46 or older).<br><br>My own version of this: <a href="https://github.com/jsummers/myfilecmdmagic/blob/073aa4a2f9c734452156f61ed67102a7b58c012a/workshop/dclimplode2.magic">https://github.com/jsummers/myfilecmdmagic/blob/073aa4a2f9c734452156f61ed67102a7b58c012a/workshop/dclimplode2.magic</a><br><br>A more compatible fix could be to redesign it to make use of the "return value" of the "use ttcomp" lines. My own version of this: <a href="https://github.com/jsummers/myfilecmdmagic/blob/073aa4a2f9c734452156f61ed67102a7b58c012a/misc_magic/misc.magic#L455">https://github.com/jsummers/myfilecmdmagic/blob/073aa4a2f9c734452156f61ed67102a7b58c012a/misc_magic/misc.magic#L455</a></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, May 31, 2025 at 10:58 AM Christos Zoulas <<a href="mailto:christos@zoulas.com">christos@zoulas.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Applied, thanks!<br>
<br>
christos<br>
<br>
> On May 31, 2025, at 10:38 AM, A. IOOSS <<a href="mailto:erdnaxe@crans.org" target="_blank">erdnaxe@crans.org</a>> wrote:<br>
> <br>
> Hello,<br>
> <br>
> While working on improving ARM Cortex-M matching, I noticed that some firmware images are detected as 'TTComp archive data, binary, 1K dictionary' which is very wrong. This happens because the image starts with '0004' which also match TTComp magic.<br>
> <br>
> Looking a bit closer at TTComp magic, I noticed that J. Jenderek pointed <a href="https://mark0.net/forum/index.php?topic=848" rel="noreferrer" target="_blank">https://mark0.net/forum/index.php?topic=848</a> as a possible improvement to reduce false positives (thanks!).<br>
> Attached you may find a patch that implements the matching on the last 2 bytes of TTComp files using this idea.<br>
> <br>
> This patch was tested using samples linked on <a href="http://fileformats.archiveteam.org/wiki/TTCOMP" rel="noreferrer" target="_blank">http://fileformats.archiveteam.org/wiki/TTCOMP</a> :<br>
> ```<br>
> BRTSWFTE.TTC: TTComp archive data<br>
> CYBSWFTE.TTC: TTComp archive data<br>
> GCBSWFTE.TTC: TTComp archive data<br>
> GCISWFTE.TTC: TTComp archive data<br>
> GCNSWFTE.TTC: TTComp archive data<br>
> ```<br>
> <br>
> Thanks a lot,<br>
> -- A.<br>
> <ttcomp-fix.patch>-- <br>
> File mailing list<br>
> <a href="mailto:File@astron.com" target="_blank">File@astron.com</a><br>
> <a href="https://mailman.astron.com/mailman/listinfo/file" rel="noreferrer" target="_blank">https://mailman.astron.com/mailman/listinfo/file</a><br>
<br>
-- <br>
File mailing list<br>
<a href="mailto:File@astron.com" target="_blank">File@astron.com</a><br>
<a href="https://mailman.astron.com/mailman/listinfo/file" rel="noreferrer" target="_blank">https://mailman.astron.com/mailman/listinfo/file</a><br>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Jason Summers<div><br></div></div></div>