#104 kSignatureDummy?

open-accepted
my space
None
5
2010-09-20
2010-09-17
No

p7zip_9.13 CPP/7zip/Archive/7z/7zHeader.cpp says:
Byte kSignature[kSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};

// To insure kSignature[0x1A]!= 0 and kSignature[0x1B] != 0
char kSignatureDummy[]="1234567890123456789012";

kSignatureDummy[] need not be stored just after kSignature[] in
memory just because it's declared just after, at least if C++ is
like C in this respect. So what the comment says is not true.

Discussion

  • my p7zip
    my p7zip
    2010-09-20

    • assigned_to: nobody --> myspace
    • status: open --> open-accepted
     
  • my p7zip
    my p7zip
    2010-09-20

    I think you are right about "kSignatureDummy[] need not be stored just after kSignature[] in memory just because it's declared just after"

     
  • BTW, the same comment

    // To insure kSignature[0x1A]!= 0 and kSignature[0x1B] != 0

    also occurs inside the g_ArchInfo declaration in 7zRegister.cpp
    where it makes even less sense. Presumably "kSignature" in that
    comment should be "g_ArchInfo.Signature".

    But at least that comment is otherwise right. struct CArchInfo has
    Byte Signature[28]; // FIXME Byte Signature[16];
    to accomodate this.