Opened 10 years ago

Closed 10 years ago

#4008 closed bug (fixed)

Detecting bitmaps with enough Translators will corrupt memory.

Reported by: stippi Owned by: stippi
Priority: normal Milestone: R1/alpha1
Component: System/runtime_loader Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description (last modified by stippi)

When importing media files into Clockwerk, the presence of more than 13 Translators will cause crashes later on. Clockwerk tries to detect files as bitmaps first, then as media files. Luckily, it is reproducible 100% as soon as the first media file is dropped on the clip list. Will look into it ASAP, if no one beats me to it.

Change History (3)

comment:1 by stippi, 10 years ago

Description: modified (diff)
Summary: TGA and WonderBrush Translator corrupt memory.Detecting bitmaps with enough Translators will corrupt memory.

comment:2 by bonefish, 10 years ago

Component: Add-Ons/TranslatorsSystem/runtime_loader
Milestone: R1R1/alpha1

Quite likely a runtime loader problem. It maps the segments of a shared object individually, usually letting the kernel choose the base address of the first segment and using B_EXACT_ADDRESS for the second one. That is a problem, since the kernel could pick an address that is fine for the first segment, but which leaves insufficient room for the second segment. Since _kern_map_file() has mmap() semantics, mapping the second segment would just unmap areas that are in the way. In case of the reported problem the victim might be an innocent bitmap.

Two suggested changes:

  • _kern_map_file() should be extended to allow disabling the unmapping feature and the runtime loader should use it that way.
  • The runtime loader should not map the segments individually, respectively first reserve an address range for all segments.

comment:3 by axeld, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev31113 (the corruption), and hrev31115 (runtime loader now reserves memory upfront).

Note: See TracTickets for help on using tickets.