[haiku-bugs] [Haiku] #17773: Installing certain HPKG files can crash the system

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 05 Jun 2022 15:40:31 -0000

#17773: Installing certain HPKG files can crash the system
------------------------------+-----------------------------
 Reporter:  trungnt2910       |       Owner:  nobody
     Type:  bug               |      Status:  new
 Priority:  normal            |   Milestone:  Unscheduled
Component:  Kits/Package Kit  |     Version:  R1/Development
 Keywords:                    |  Blocked By:
 Blocking:                    |    Platform:  All
------------------------------+-----------------------------
 Installing a HPKG file made by a third-party builder, that perfectly
 conforms to the specs defined here:
 
https://github.com/haiku/haiku/blob/master/docs/develop/packages/FileFormat.rst,
 may still crash the kernel, when {{{B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE}}}
 is listed as a child attribute of a symlink
 {{{B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY }}} before
 {{{B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH}}} is listed.

 This happens because the code at:
 
https://xref.landonf.org/source/xref/haiku/src/kits/package/hpkg/PackageReaderImpl.cpp#193
 calls the handler when {{{B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE}}} is
 encountered. However, at that time, {{{B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH}}}
 has not been parsed, and the symlink path for the DirectoryEntry is still
 {{{NULL}}}.

 To reproduce, either use the package attached, or if you don't trust the
 attached package, you can use the sample app at
 
https://github.com/trungnt2910/HpkgReader/tree/6421dfcb7796e1ee6d186f52b9cab0b03f8d3e6a
 (only this specific commit produces packages that break Haiku) on any
 Windows or Linux machine, import the sample Tipster package provided here:
 https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-
 packagefile/src/test/resources/tipster-1.1.1-1-x86_64.hpkg to the sample
 application, and then export a new hpkg file.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/17773>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: