View Issue Details

IDProjectCategoryView StatusLast Update
0000562fileGeneralpublic2024-11-10 18:33
Reporterjsummers Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.45 
Fixed in VersionHEAD 
Summary0000562: Using "search" in a "name" item messes up the current offset
DescriptionWrite a magic pattern that calls a "name" item using "use", with a nonzero offset. Like:

>64 use some_named_item

Inside the corresponding "name" item, do a "search" or "regex". Then if the search succeeded, try to read the next field after the match, using a relative offset. E.g.:

0 name some_named_item
>0 search ABC
>>&0 ubyte x %u

It doesn't work. It reads the file at a completely wrong offset (I guess it's wrong by an amount equaling the offset in the "use" line).
Steps To ReproduceUsing the attached files...

$ file -m searchbug.magic searchbug.dat
searchbug.dat: Testfmt (0) found_ABC followed_by 0x31 at_offset 11 (64) found_ABC followed_by 0x2a at_offset 139

Expected:

searchbug.dat: Testfmt (0) found_ABC followed_by 0x31 at_offset 11 (64) found_ABC followed_by 0x32 at_offset 75
Additional InformationHere are the only files I could find in the included pattern database that *might* trigger the bug. I haven't tried to verify any of them.

c64 (lines 358->658->660)
nim-lang (lines 9->18->19)
ole2compounddocs (lines 64->317->321)
rtf (lines 78->39->41)
TagsNo tags attached.

Activities

jsummers

2024-09-15 13:42

reporter  

searchbug.zip (443 bytes)

christos

2024-11-10 18:33

manager   ~0004103

Fixed, thanks!

Issue History

Date Modified Username Field Change
2024-09-15 13:42 jsummers New Issue
2024-09-15 13:42 jsummers File Added: searchbug.zip
2024-11-10 18:33 christos Assigned To => christos
2024-11-10 18:33 christos Status new => assigned
2024-11-10 18:33 christos Status assigned => resolved
2024-11-10 18:33 christos Resolution open => fixed
2024-11-10 18:33 christos Fixed in Version => HEAD
2024-11-10 18:33 christos Note Added: 0004103