You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(10) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(2) |
May
(10) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(4) |
Aug
(6) |
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(4) |
2009 |
Jan
(9) |
Feb
(2) |
Mar
(2) |
Apr
(2) |
May
(6) |
Jun
(18) |
Jul
(33) |
Aug
(39) |
Sep
(33) |
Oct
(24) |
Nov
(23) |
Dec
(22) |
2010 |
Jan
(29) |
Feb
(32) |
Mar
(51) |
Apr
(17) |
May
(31) |
Jun
(21) |
Jul
(32) |
Aug
(28) |
Sep
(35) |
Oct
(27) |
Nov
(11) |
Dec
(13) |
2011 |
Jan
(14) |
Feb
(13) |
Mar
(27) |
Apr
(27) |
May
(28) |
Jun
(20) |
Jul
(43) |
Aug
(52) |
Sep
(66) |
Oct
(61) |
Nov
(11) |
Dec
(8) |
2012 |
Jan
(20) |
Feb
(30) |
Mar
(38) |
Apr
(21) |
May
(33) |
Jun
(21) |
Jul
(25) |
Aug
(9) |
Sep
(24) |
Oct
(42) |
Nov
(27) |
Dec
(41) |
2013 |
Jan
(20) |
Feb
(35) |
Mar
(156) |
Apr
(298) |
May
(258) |
Jun
(201) |
Jul
(105) |
Aug
(60) |
Sep
(193) |
Oct
(245) |
Nov
(280) |
Dec
(194) |
2014 |
Jan
(63) |
Feb
(202) |
Mar
(200) |
Apr
(23) |
May
(53) |
Jun
(105) |
Jul
(18) |
Aug
(26) |
Sep
(110) |
Oct
(187) |
Nov
(97) |
Dec
(74) |
2015 |
Jan
(45) |
Feb
(55) |
Mar
(116) |
Apr
(116) |
May
(193) |
Jun
(164) |
Jul
(50) |
Aug
(111) |
Sep
(98) |
Oct
(71) |
Nov
(103) |
Dec
(63) |
2016 |
Jan
(33) |
Feb
(101) |
Mar
(182) |
Apr
(139) |
May
(140) |
Jun
(103) |
Jul
(165) |
Aug
(286) |
Sep
(208) |
Oct
(127) |
Nov
(97) |
Dec
(54) |
2017 |
Jan
(64) |
Feb
(335) |
Mar
(202) |
Apr
(212) |
May
(139) |
Jun
(127) |
Jul
(294) |
Aug
(154) |
Sep
(170) |
Oct
(152) |
Nov
(156) |
Dec
(62) |
2018 |
Jan
(168) |
Feb
(237) |
Mar
(196) |
Apr
(174) |
May
(174) |
Jun
(161) |
Jul
(127) |
Aug
(88) |
Sep
(149) |
Oct
(66) |
Nov
(52) |
Dec
(135) |
2019 |
Jan
(146) |
Feb
(126) |
Mar
(104) |
Apr
(58) |
May
(60) |
Jun
(28) |
Jul
(197) |
Aug
(129) |
Sep
(141) |
Oct
(148) |
Nov
(63) |
Dec
(100) |
2020 |
Jan
(74) |
Feb
(37) |
Mar
(59) |
Apr
(154) |
May
(194) |
Jun
(133) |
Jul
(313) |
Aug
(197) |
Sep
(49) |
Oct
(162) |
Nov
(143) |
Dec
(57) |
2021 |
Jan
(120) |
Feb
(107) |
Mar
(314) |
Apr
(157) |
May
(524) |
Jun
(169) |
Jul
(72) |
Aug
(133) |
Sep
(135) |
Oct
(146) |
Nov
(198) |
Dec
(325) |
2022 |
Jan
(409) |
Feb
(249) |
Mar
(138) |
Apr
(95) |
May
(102) |
Jun
(221) |
Jul
(66) |
Aug
(120) |
Sep
(192) |
Oct
(131) |
Nov
(53) |
Dec
(171) |
2023 |
Jan
(357) |
Feb
(82) |
Mar
(168) |
Apr
(218) |
May
(196) |
Jun
(86) |
Jul
(115) |
Aug
(49) |
Sep
(190) |
Oct
(102) |
Nov
(45) |
Dec
(76) |
2024 |
Jan
(86) |
Feb
(50) |
Mar
(324) |
Apr
(209) |
May
(197) |
Jun
(232) |
Jul
(194) |
Aug
(247) |
Sep
(219) |
Oct
(266) |
Nov
(328) |
Dec
(304) |
2025 |
Jan
(191) |
Feb
(115) |
Mar
(137) |
Apr
(32) |
May
(126) |
Jun
(403) |
Jul
(213) |
Aug
(182) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@op...> - 2024-06-08 21:25:58
|
Author: sagamusix Date: Sat Jun 8 23:25:51 2024 New Revision: 20978 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20978 Log: Merged revision(s) 20957 from trunk/OpenMPT: [Fix] DTM: Finetune needs to be handled separately for correct period calculation. Fixes the slides in AMAI.DTM by Yerzmyey (libopenmpt only). ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/soundlib/Load_dtm.cpp branches/OpenMPT-1.30/soundlib/Snd_fx.cpp Modified: branches/OpenMPT-1.30/soundlib/Load_dtm.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Load_dtm.cpp Sat Jun 8 23:25:08 2024 (r20977) +++ branches/OpenMPT-1.30/soundlib/Load_dtm.cpp Sat Jun 8 23:25:51 2024 (r20978) @@ -97,7 +97,12 @@ // In revolution to come.dtm, the file header says samples rate is 24512 Hz, but samples say it's 50000 Hz // Digital Home Studio ignores the header setting in 2.04-/2.06-style modules mptSmp.nC5Speed = (formatVersion == DTM_PT_PATTERN_FORMAT && forcedSampleRate > 0) ? forcedSampleRate : sampleRate; - int32 transposeAmount = MOD2XMFineTune(finetune); + int32 transposeAmount = 0; +#ifdef MODPLUG_TRACKER + transposeAmount = MOD2XMFineTune(finetune); +#else + mptSmp.nFineTune = MOD2XMFineTune(finetune); +#endif if(formatVersion == DTM_206_PATTERN_FORMAT && transpose > 0 && transpose != 48) { // Digital Home Studio applies this unconditionally, but some old songs sound wrong then (delirium.dtm). @@ -437,26 +442,18 @@ { m->note = note + NOTE_MIN + 12; if(position.rem) - { - m->command = CMD_MODCMDEX; - m->param = 0xD0 | static_cast<ModCommand::PARAM>(std::min(position.rem, 15)); - } + m->SetEffectCommand(CMD_MODCMDEX, static_cast<ModCommand::PARAM>(0xD0 | std::min(position.rem, 15))); } else if(note & 0x80) { // Lower 7 bits contain note, probably intended for MIDI-like note-on/note-off events if(position.rem) - { - m->command = CMD_MODCMDEX; - m->param = 0xC0 | static_cast<ModCommand::PARAM>(std::min(position.rem, 15)); - } else - { + m->SetEffectCommand(CMD_MODCMDEX, static_cast<ModCommand::PARAM>(0xC0 |std::min(position.rem, 15))); + else m->note = NOTE_NOTECUT; - } } if(volume) { - m->volcmd = VOLCMD_VOLUME; - m->vol = std::min(volume, uint8(64)); // Volume can go up to 255, but we do not support over-amplification at the moment. + m->SetVolumeCommand(VOLCMD_VOLUME, std::min(volume, uint8(64))); // Volume can go up to 255, but we do not support over-amplification at the moment. } if(instr) { Modified: branches/OpenMPT-1.30/soundlib/Snd_fx.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Snd_fx.cpp Sat Jun 8 23:25:08 2024 (r20977) +++ branches/OpenMPT-1.30/soundlib/Snd_fx.cpp Sat Jun 8 23:25:51 2024 (r20978) @@ -5990,11 +5990,16 @@ note -= NOTE_MIN; if(!UseFinetuneAndTranspose()) { - if(GetType() & (MOD_TYPE_MDL | MOD_TYPE_DTM)) + if(GetType() == MOD_TYPE_MDL) { // MDL uses non-linear slides, but their effectiveness does not depend on the middle-C frequency. MPT_ASSERT(!PeriodsAreFrequencies()); return (FreqS3MTable[note % 12u] << 4) >> (note / 12); + } else if(GetType() == MOD_TYPE_DTM) + { + // Similar to MDL, but finetune is factored in and we don't transpose everything by an octave + MPT_ASSERT(!PeriodsAreFrequencies()); + return (ProTrackerTunedPeriods[XM2MODFineTune(nFineTune) * 12u + note % 12u] << 5) >> (note / 12u); } if(!nC5Speed) nC5Speed = 8363; @@ -6110,7 +6115,7 @@ { // We only really use c5speed for the finetune pattern command. All samples in 669 files have the same middle-C speed (imported as 8363 Hz). return (period + c5speed - 8363) << FREQ_FRACBITS; - } else if(GetType() & (MOD_TYPE_MDL | MOD_TYPE_DTM)) + } else if(GetType() == MOD_TYPE_MDL) { MPT_ASSERT(!PeriodsAreFrequencies()); LimitMax(period, Util::MaxValueOfType(period) >> 8); @@ -6124,7 +6129,7 @@ // Input is already a frequency in Hertz, not a period. static_assert(FREQ_FRACBITS <= 8, "Check this shift operator"); return uint32(((uint64(period) << 8) + nPeriodFrac) >> (8 - FREQ_FRACBITS)); - } else if(m_SongFlags[SONG_LINEARSLIDES]) + } else if(m_SongFlags[SONG_LINEARSLIDES] || GetType() == MOD_TYPE_DTM) { if(!c5speed) c5speed = 8363; |
From: <sv...@op...> - 2024-06-08 21:25:20
|
Author: sagamusix Date: Sat Jun 8 23:25:08 2024 New Revision: 20977 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20977 Log: Merged revision(s) 20883, 20947 from trunk/OpenMPT: [Fix] AMS: Default channel panning was broken, using all-center panning instead of MOD panning. ........ [Fix] STM/STX: Don't import channels with panning. ST2 only outputs mono sound. The SoundBlaster Pro was only released around the same time as the last ST2 release, so stereo support was just not possible (tx cs127). ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/soundlib/Load_ams.cpp branches/OpenMPT-1.30/soundlib/Load_stm.cpp Modified: branches/OpenMPT-1.30/soundlib/Load_ams.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Load_ams.cpp Sat Jun 8 23:21:16 2024 (r20976) +++ branches/OpenMPT-1.30/soundlib/Load_ams.cpp Sat Jun 8 23:25:08 2024 (r20977) @@ -400,6 +400,7 @@ } InitializeGlobals(MOD_TYPE_AMS); + InitializeChannels(); m_SongFlags = SONG_ITCOMPATGXX | SONG_ITOLDEFFECTS; m_nChannels = (fileHeader.channelConfig & 0x1F) + 1; @@ -434,7 +435,6 @@ // Read channel names for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { - ChnSettings[chn].Reset(); file.ReadSizedString<uint8le, mpt::String::spacePadded>(ChnSettings[chn].szName); } Modified: branches/OpenMPT-1.30/soundlib/Load_stm.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Load_stm.cpp Sat Jun 8 23:21:16 2024 (r20976) +++ branches/OpenMPT-1.30/soundlib/Load_stm.cpp Sat Jun 8 23:25:08 2024 (r20977) @@ -230,6 +230,7 @@ return true; InitializeGlobals(MOD_TYPE_STM); + InitializeChannels(); m_songName = mpt::String::ReadBuf(mpt::String::maybeNullTerminated, fileHeader.songname); @@ -258,13 +259,6 @@ if(fileHeader.verMinor > 10) m_nDefaultGlobalVolume = std::min(fileHeader.globalVolume, uint8(64)) * 4u; - // Setting up channels - for(CHANNELINDEX chn = 0; chn < 4; chn++) - { - ChnSettings[chn].Reset(); - ChnSettings[chn].nPan = (chn & 1) ? 0x40 : 0xC0; - } - // Read samples uint16 sampleOffsets[31]; for(SAMPLEINDEX smp = 1; smp <= 31; smp++) @@ -462,6 +456,7 @@ return true; InitializeGlobals(MOD_TYPE_STM); + InitializeChannels(); m_songName = mpt::String::ReadBuf(mpt::String::maybeNullTerminated, fileHeader.songName); @@ -480,13 +475,6 @@ m_nDefaultSpeed = initTempo >> 4; m_nDefaultGlobalVolume = std::min(fileHeader.globalVolume, uint8(64)) * 4u; - // Setting up channels - for(CHANNELINDEX chn = 0; chn < 4; chn++) - { - ChnSettings[chn].Reset(); - ChnSettings[chn].nPan = (chn & 1) ? 0x40 : 0xC0; - } - std::vector<uint16le> patternOffsets, sampleOffsets; file.Seek(fileHeader.patTableOffset << 4); file.ReadVector(patternOffsets, fileHeader.numPatterns); |
From: <sv...@op...> - 2024-06-08 21:21:28
|
Author: sagamusix Date: Sat Jun 8 23:21:16 2024 New Revision: 20976 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20976 Log: [Doc] libopenmpt: Update changelog. Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Modified: branches/OpenMPT-1.31/doc/libopenmpt/changelog.md ============================================================================== --- branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Jun 8 23:18:41 2024 (r20975) +++ branches/OpenMPT-1.31/doc/libopenmpt/changelog.md Sat Jun 8 23:21:16 2024 (r20976) @@ -7,6 +7,24 @@ ### libopenmpt 0.7.8-pre + * [**Sec**] Potential heap out-of-bounds read with malformed Dynamic Studio + DSm files (r20912). + + * MED: Additional command pages can now be read. + * MED: Echo DSP is now emulated. + * AMS: Default channel panning was broken, using all-center panning instead of + MOD-style panning. + * STP: Correctly import volume slides where both nibbles are set. + * MDL: Pitch slide depth was wrong since libopenmpt 0.6.0. + * DTM: Fix pitch slide depth for samples with finetune. + * DSm: Don't import as Amiga module (and thus allow Amiga resampler to be + enabled), as this PC format can easily exceed the Amiga frequency range. + * DSm: Only the first 48 samples were ever read. + * STM / STX: Don't set channel panning. ScreamTracker 2 only outputs mono + sound. + * PSM: File header probing was stricter than actual file loader, rejecting + manipulated files that would otherwise load fine. + ### libopenmpt 0.7.7 (2024-05-12) * [**Bug**] `examples/libopenmpt_example_c_pipe.c` and |
From: <sv...@op...> - 2024-06-08 21:18:53
|
Author: sagamusix Date: Sat Jun 8 23:18:41 2024 New Revision: 20975 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20975 Log: Merged revision(s) 20974 from trunk/OpenMPT: [Var] unrar: Update to v7.0.9. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/include/unrar/OpenMPT.txt branches/OpenMPT-1.31/include/unrar/arccmt.cpp branches/OpenMPT-1.31/include/unrar/arcread.cpp branches/OpenMPT-1.31/include/unrar/cmddata.cpp branches/OpenMPT-1.31/include/unrar/crypt.cpp branches/OpenMPT-1.31/include/unrar/crypt.hpp branches/OpenMPT-1.31/include/unrar/crypt5.cpp branches/OpenMPT-1.31/include/unrar/extract.cpp branches/OpenMPT-1.31/include/unrar/filefn.cpp branches/OpenMPT-1.31/include/unrar/isnt.cpp branches/OpenMPT-1.31/include/unrar/options.hpp branches/OpenMPT-1.31/include/unrar/os.hpp branches/OpenMPT-1.31/include/unrar/rdwrfn.cpp branches/OpenMPT-1.31/include/unrar/rdwrfn.hpp branches/OpenMPT-1.31/include/unrar/rijndael.cpp branches/OpenMPT-1.31/include/unrar/unpack15.cpp branches/OpenMPT-1.31/include/unrar/version.hpp Modified: branches/OpenMPT-1.31/include/unrar/OpenMPT.txt ============================================================================== --- branches/OpenMPT-1.31/include/unrar/OpenMPT.txt Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/OpenMPT.txt Sat Jun 8 23:18:41 2024 (r20975) @@ -1,4 +1,4 @@ -This folder is based on https://rarlab.com/rar/unrarsrc-7.0.7.tar.gz +This folder is based on https://rarlab.com/rar/unrarsrc-7.0.9.tar.gz All modifications to existing files have been done in a manner so that no existing lines were edited; only new lines were added. Modified: branches/OpenMPT-1.31/include/unrar/arccmt.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/arccmt.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/arccmt.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -101,9 +101,8 @@ // 4x memory for OEM to UTF-8 output here. OemToCharBuffA((char *)UnpData,(char *)UnpData,(DWORD)UnpDataSize); #endif -// CmtData.resize(UnpDataSize+1); - CharToWide((const char *)UnpData,CmtData); -// CmtData.resize(wcslen(CmtData->data())); + std::string UnpStr((char*)UnpData,UnpDataSize); + CharToWide(UnpStr,CmtData); } } } Modified: branches/OpenMPT-1.31/include/unrar/arcread.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/arcread.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/arcread.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -122,7 +122,7 @@ void Archive::UnkEncVerMsg(const std::wstring &Name,const std::wstring &Info) { uiMsg(UIERROR_UNKNOWNENCMETHOD,FileName,Name,Info); - ErrHandler.SetErrorCode(RARX_WARNING); + ErrHandler.SetErrorCode(RARX_FATAL); } @@ -587,10 +587,10 @@ RequestArcPassword(CheckPwd.IsSet() ? &CheckPwd:NULL); byte PswCheck[SIZE_PSWCHECK]; - HeadersCrypt.SetCryptKeys(false,CRYPT_RAR50,&Cmd->Password,CryptHead.Salt,HeadersInitV,CryptHead.Lg2Count,NULL,PswCheck); + bool EncSet=HeadersCrypt.SetCryptKeys(false,CRYPT_RAR50,&Cmd->Password,CryptHead.Salt,HeadersInitV,CryptHead.Lg2Count,NULL,PswCheck); // Verify password validity. If header is damaged, we cannot rely on // password check value, because it can be damaged too. - if (CryptHead.UsePswCheck && !BrokenHeader && + if (EncSet && CryptHead.UsePswCheck && !BrokenHeader && memcmp(PswCheck,CryptHead.PswCheck,SIZE_PSWCHECK)!=0) { if (GlobalPassword) // For -p<pwd> or Ctrl+P. @@ -1050,35 +1050,38 @@ hd->Lg2Count=Raw->Get1(); if (hd->Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX) UnkEncVerMsg(hd->FileName,L"xc" + std::to_wstring(hd->Lg2Count)); - Raw->GetB(hd->Salt,SIZE_SALT50); - Raw->GetB(hd->InitV,SIZE_INITV); - if (hd->UsePswCheck) + else { - Raw->GetB(hd->PswCheck,SIZE_PSWCHECK); - - // It is important to know if password check data is valid. - // If it is damaged and header CRC32 fails to detect it, - // archiver would refuse to decompress a possibly valid file. - // Since we want to be sure distinguishing a wrong password - // or corrupt file data, we use 64-bit password check data - // and to control its validity we use 32 bits of password - // check data SHA-256 additionally to 32-bit header CRC32. - byte csum[SIZE_PSWCHECK_CSUM]; - Raw->GetB(csum,SIZE_PSWCHECK_CSUM); - - byte Digest[SHA256_DIGEST_SIZE]; - sha256_get(hd->PswCheck, SIZE_PSWCHECK, Digest); - - hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; - - // RAR 5.21 and earlier set PswCheck field in service records to 0 - // even if UsePswCheck was present. - if (bb->HeaderType==HEAD_SERVICE && memcmp(hd->PswCheck,"\0\0\0\0\0\0\0\0",SIZE_PSWCHECK)==0) - hd->UsePswCheck=0; + Raw->GetB(hd->Salt,SIZE_SALT50); + Raw->GetB(hd->InitV,SIZE_INITV); + if (hd->UsePswCheck) + { + Raw->GetB(hd->PswCheck,SIZE_PSWCHECK); + + // It is important to know if password check data is valid. + // If it is damaged and header CRC32 fails to detect it, + // archiver would refuse to decompress a possibly valid file. + // Since we want to be sure distinguishing a wrong password + // or corrupt file data, we use 64-bit password check data + // and to control its validity we use 32 bits of password + // check data SHA-256 additionally to 32-bit header CRC32. + byte csum[SIZE_PSWCHECK_CSUM]; + Raw->GetB(csum,SIZE_PSWCHECK_CSUM); + + byte Digest[SHA256_DIGEST_SIZE]; + sha256_get(hd->PswCheck, SIZE_PSWCHECK, Digest); + + hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; + + // RAR 5.21 and earlier set PswCheck field in service records to 0 + // even if UsePswCheck was present. + if (bb->HeaderType==HEAD_SERVICE && memcmp(hd->PswCheck,"\0\0\0\0\0\0\0\0",SIZE_PSWCHECK)==0) + hd->UsePswCheck=0; + } + hd->SaltSet=true; + hd->CryptMethod=CRYPT_RAR50; + hd->Encrypted=true; } - hd->SaltSet=true; - hd->CryptMethod=CRYPT_RAR50; - hd->Encrypted=true; } } break; Modified: branches/OpenMPT-1.31/include/unrar/cmddata.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/cmddata.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/cmddata.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -426,7 +426,7 @@ break; case '4': // Convert slashes here than before every comparison. - SlashToNative(Switch+3,ArcPath); + SlashToNative(Switch+3,ExclArcPath); break; default: BadSwitch(Switch); Modified: branches/OpenMPT-1.31/include/unrar/crypt.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/crypt.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/crypt.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -60,6 +60,8 @@ WideToChar(PwdW,PwdA,ASIZE(PwdA)); PwdA[Min(MAXPASSWORD_RAR,MAXPASSWORD)-1]=0; // For compatibility with existing archives. + bool Success=true; + switch(Method) { #ifndef SFX_MODULE @@ -77,12 +79,12 @@ SetKey30(Encrypt,Password,PwdW,Salt); break; case CRYPT_RAR50: - SetKey50(Encrypt,Password,PwdW,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + Success=SetKey50(Encrypt,Password,PwdW,Salt,InitV,Lg2Cnt,HashKey,PswCheck); break; } cleandata(PwdA,sizeof(PwdA)); cleandata(PwdW,sizeof(PwdW)); - return true; + return Success; } Modified: branches/OpenMPT-1.31/include/unrar/crypt.hpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/crypt.hpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/crypt.hpp Sat Jun 8 23:18:41 2024 (r20975) @@ -79,7 +79,7 @@ void DecryptBlock20(byte *Buf); void SetKey30(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt); - void SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck); + bool SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck); KDF3CacheItem KDF3Cache[4]; uint KDF3CachePos; Modified: branches/OpenMPT-1.31/include/unrar/crypt5.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/crypt5.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/crypt5.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -128,20 +128,12 @@ } -void CryptData::SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW, +bool CryptData::SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW, const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey, byte *PswCheck) { if (Lg2Cnt>CRYPT5_KDF_LG2_COUNT_MAX) - { - // Initialize these fields to prevent uninitialized data access warnings - // by analyzing tools when accessing returned data. - if (HashKey!=nullptr) - memset(HashKey,0,SHA256_DIGEST_SIZE); - if (PswCheck!=nullptr) - memset(PswCheck,0,SIZE_PSWCHECK); - return; - } + return false; byte Key[32],PswCheckValue[SHA256_DIGEST_SIZE],HashKeyValue[SHA256_DIGEST_SIZE]; bool Found=false; @@ -194,6 +186,7 @@ rin.Init(Encrypt, Key, 256, InitV); cleandata(Key,sizeof(Key)); + return true; } Modified: branches/OpenMPT-1.31/include/unrar/extract.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/extract.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/extract.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -586,14 +586,14 @@ #endif byte PswCheck[SIZE_PSWCHECK]; - DataIO.SetEncryption(false,Arc.FileHead.CryptMethod,&FilePassword, - Arc.FileHead.SaltSet ? Arc.FileHead.Salt:NULL, + bool EncSet=DataIO.SetEncryption(false,Arc.FileHead.CryptMethod, + &FilePassword,Arc.FileHead.SaltSet ? Arc.FileHead.Salt:nullptr, Arc.FileHead.InitV,Arc.FileHead.Lg2Count, Arc.FileHead.HashKey,PswCheck); // If header is damaged, we cannot rely on password check value, // because it can be damaged too. - if (Arc.FileHead.UsePswCheck && !Arc.BrokenHeader && + if (EncSet && Arc.FileHead.UsePswCheck && !Arc.BrokenHeader && memcmp(Arc.FileHead.PswCheck,PswCheck,SIZE_PSWCHECK)!=0) { if (GlobalPassword) // For -p<pwd> or Ctrl+P to avoid the infinite loop. @@ -968,7 +968,7 @@ if (SetTimeAndSize) { - // We could preallocate more space that really written to broken file + // We could preallocate more space than really written to broken file // or file with crafted header. if (Preallocated>0 && (BrokenFile || DataIO.CurUnpWrite!=Preallocated)) CurFile.Truncate(); Modified: branches/OpenMPT-1.31/include/unrar/filefn.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/filefn.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/filefn.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -239,8 +239,9 @@ { #if defined(_UNIX) && defined(S_ISFIFO) && defined(S_ISSOCK) && defined(S_ISCHR) return S_ISFIFO(Attr) || S_ISSOCK(Attr) || S_ISCHR(Attr); -#endif +#else return false; +#endif } Modified: branches/OpenMPT-1.31/include/unrar/isnt.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/isnt.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/isnt.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -40,7 +40,7 @@ IWbemServices *pSvc = NULL; - hres = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"),NULL,NULL,NULL,NULL,0,0,&pSvc); + hres = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"),NULL,NULL,NULL,0,NULL,NULL,&pSvc); if (FAILED(hres)) { Modified: branches/OpenMPT-1.31/include/unrar/options.hpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/options.hpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/options.hpp Sat Jun 8 23:18:41 2024 (r20975) @@ -33,7 +33,7 @@ RECURSE_NONE=0, // no recurse switches RECURSE_DISABLE, // switch -r- RECURSE_ALWAYS, // switch -r - RECURSE_WILDCARDS, // switch -r0 + RECURSE_WILDCARDS // switch -r0 }; enum OVERWRITE_MODE Modified: branches/OpenMPT-1.31/include/unrar/os.hpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/os.hpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/os.hpp Sat Jun 8 23:18:41 2024 (r20975) @@ -11,6 +11,7 @@ #include <new> #include <string> #include <vector> +#include <deque> #include <memory> // For automatic pointers. @@ -215,6 +216,10 @@ #endif #endif +#ifdef __VMS +# define LITTLE_ENDIAN +#endif + // Unlike Apple x64, utimensat shall be available in all Apple M1 systems. #if _POSIX_C_SOURCE >= 200809L || defined(__APPLE__) && defined(__arm64__) #define UNIX_TIME_NS // Nanosecond time precision in Unix. Modified: branches/OpenMPT-1.31/include/unrar/rdwrfn.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/rdwrfn.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/rdwrfn.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -249,15 +249,24 @@ } -void ComprDataIO::SetEncryption(bool Encrypt,CRYPT_METHOD Method, +// Return true if encryption or decryption mode is set correctly. +bool ComprDataIO::SetEncryption(bool Encrypt,CRYPT_METHOD Method, SecPassword *Password,const byte *Salt,const byte *InitV, uint Lg2Cnt,byte *HashKey,byte *PswCheck) { -#ifndef RAR_NOCRYPT +#ifdef RAR_NOCRYPT + return false; +#else if (Encrypt) + { Encryption=Crypt->SetCryptKeys(true,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + return Encryption; + } else + { Decryption=Decrypt->SetCryptKeys(false,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + return Decryption; + } #endif } Modified: branches/OpenMPT-1.31/include/unrar/rdwrfn.hpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/rdwrfn.hpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/rdwrfn.hpp Sat Jun 8 23:18:41 2024 (r20975) @@ -66,7 +66,7 @@ void SetFiles(File *SrcFile,File *DestFile); void SetCommand(CmdAdd *Cmd) {Command=Cmd;} void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;} - void SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password, + bool SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password, const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck); void SetCmt13Encryption(); void SetUnpackToMemory(byte *Addr,uint Size); Modified: branches/OpenMPT-1.31/include/unrar/rijndael.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/rijndael.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/rijndael.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -84,6 +84,7 @@ { if (S5[0]==0) GenerateTables(); + m_uRounds = 0; CBCMode = true; // Always true for RAR. #ifdef USE_SSE AES_NI=false; Modified: branches/OpenMPT-1.31/include/unrar/unpack15.cpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/unpack15.cpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/unpack15.cpp Sat Jun 8 23:18:41 2024 (r20975) @@ -474,7 +474,8 @@ void Unpack::CopyString15(uint Distance,uint Length) { DestUnpSize-=Length; - if (!FirstWinDone && Distance>UnpPtr || Distance>MaxWinSize) + // 2024.04.18: Distance can be 0 in corrupt RAR 1.5 archives. + if (!FirstWinDone && Distance>UnpPtr || Distance>MaxWinSize || Distance==0) while (Length-- > 0) { Window[UnpPtr]=0; Modified: branches/OpenMPT-1.31/include/unrar/version.hpp ============================================================================== --- branches/OpenMPT-1.31/include/unrar/version.hpp Sat Jun 8 23:18:13 2024 (r20974) +++ branches/OpenMPT-1.31/include/unrar/version.hpp Sat Jun 8 23:18:41 2024 (r20975) @@ -1,6 +1,6 @@ #define RARVER_MAJOR 7 -#define RARVER_MINOR 0 +#define RARVER_MINOR 1 #define RARVER_BETA 0 -#define RARVER_DAY 26 -#define RARVER_MONTH 2 +#define RARVER_DAY 12 +#define RARVER_MONTH 5 #define RARVER_YEAR 2024 |
From: <sv...@op...> - 2024-06-08 21:18:26
|
Author: sagamusix Date: Sat Jun 8 23:18:13 2024 New Revision: 20974 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20974 Log: [Var] unrar: Update to v7.0.9. Modified: trunk/OpenMPT/include/unrar/OpenMPT.txt trunk/OpenMPT/include/unrar/arccmt.cpp trunk/OpenMPT/include/unrar/arcread.cpp trunk/OpenMPT/include/unrar/cmddata.cpp trunk/OpenMPT/include/unrar/crypt.cpp trunk/OpenMPT/include/unrar/crypt.hpp trunk/OpenMPT/include/unrar/crypt5.cpp trunk/OpenMPT/include/unrar/extract.cpp trunk/OpenMPT/include/unrar/filefn.cpp trunk/OpenMPT/include/unrar/isnt.cpp trunk/OpenMPT/include/unrar/options.hpp trunk/OpenMPT/include/unrar/os.hpp trunk/OpenMPT/include/unrar/rdwrfn.cpp trunk/OpenMPT/include/unrar/rdwrfn.hpp trunk/OpenMPT/include/unrar/rijndael.cpp trunk/OpenMPT/include/unrar/unpack15.cpp trunk/OpenMPT/include/unrar/version.hpp Modified: trunk/OpenMPT/include/unrar/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/unrar/OpenMPT.txt Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/OpenMPT.txt Sat Jun 8 23:18:13 2024 (r20974) @@ -1,4 +1,4 @@ -This folder is based on https://rarlab.com/rar/unrarsrc-7.0.7.tar.gz +This folder is based on https://rarlab.com/rar/unrarsrc-7.0.9.tar.gz All modifications to existing files have been done in a manner so that no existing lines were edited; only new lines were added. Modified: trunk/OpenMPT/include/unrar/arccmt.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/arccmt.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/arccmt.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -101,9 +101,8 @@ // 4x memory for OEM to UTF-8 output here. OemToCharBuffA((char *)UnpData,(char *)UnpData,(DWORD)UnpDataSize); #endif -// CmtData.resize(UnpDataSize+1); - CharToWide((const char *)UnpData,CmtData); -// CmtData.resize(wcslen(CmtData->data())); + std::string UnpStr((char*)UnpData,UnpDataSize); + CharToWide(UnpStr,CmtData); } } } Modified: trunk/OpenMPT/include/unrar/arcread.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/arcread.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/arcread.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -122,7 +122,7 @@ void Archive::UnkEncVerMsg(const std::wstring &Name,const std::wstring &Info) { uiMsg(UIERROR_UNKNOWNENCMETHOD,FileName,Name,Info); - ErrHandler.SetErrorCode(RARX_WARNING); + ErrHandler.SetErrorCode(RARX_FATAL); } @@ -587,10 +587,10 @@ RequestArcPassword(CheckPwd.IsSet() ? &CheckPwd:NULL); byte PswCheck[SIZE_PSWCHECK]; - HeadersCrypt.SetCryptKeys(false,CRYPT_RAR50,&Cmd->Password,CryptHead.Salt,HeadersInitV,CryptHead.Lg2Count,NULL,PswCheck); + bool EncSet=HeadersCrypt.SetCryptKeys(false,CRYPT_RAR50,&Cmd->Password,CryptHead.Salt,HeadersInitV,CryptHead.Lg2Count,NULL,PswCheck); // Verify password validity. If header is damaged, we cannot rely on // password check value, because it can be damaged too. - if (CryptHead.UsePswCheck && !BrokenHeader && + if (EncSet && CryptHead.UsePswCheck && !BrokenHeader && memcmp(PswCheck,CryptHead.PswCheck,SIZE_PSWCHECK)!=0) { if (GlobalPassword) // For -p<pwd> or Ctrl+P. @@ -1050,35 +1050,38 @@ hd->Lg2Count=Raw->Get1(); if (hd->Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX) UnkEncVerMsg(hd->FileName,L"xc" + std::to_wstring(hd->Lg2Count)); - Raw->GetB(hd->Salt,SIZE_SALT50); - Raw->GetB(hd->InitV,SIZE_INITV); - if (hd->UsePswCheck) + else { - Raw->GetB(hd->PswCheck,SIZE_PSWCHECK); - - // It is important to know if password check data is valid. - // If it is damaged and header CRC32 fails to detect it, - // archiver would refuse to decompress a possibly valid file. - // Since we want to be sure distinguishing a wrong password - // or corrupt file data, we use 64-bit password check data - // and to control its validity we use 32 bits of password - // check data SHA-256 additionally to 32-bit header CRC32. - byte csum[SIZE_PSWCHECK_CSUM]; - Raw->GetB(csum,SIZE_PSWCHECK_CSUM); - - byte Digest[SHA256_DIGEST_SIZE]; - sha256_get(hd->PswCheck, SIZE_PSWCHECK, Digest); - - hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; - - // RAR 5.21 and earlier set PswCheck field in service records to 0 - // even if UsePswCheck was present. - if (bb->HeaderType==HEAD_SERVICE && memcmp(hd->PswCheck,"\0\0\0\0\0\0\0\0",SIZE_PSWCHECK)==0) - hd->UsePswCheck=0; + Raw->GetB(hd->Salt,SIZE_SALT50); + Raw->GetB(hd->InitV,SIZE_INITV); + if (hd->UsePswCheck) + { + Raw->GetB(hd->PswCheck,SIZE_PSWCHECK); + + // It is important to know if password check data is valid. + // If it is damaged and header CRC32 fails to detect it, + // archiver would refuse to decompress a possibly valid file. + // Since we want to be sure distinguishing a wrong password + // or corrupt file data, we use 64-bit password check data + // and to control its validity we use 32 bits of password + // check data SHA-256 additionally to 32-bit header CRC32. + byte csum[SIZE_PSWCHECK_CSUM]; + Raw->GetB(csum,SIZE_PSWCHECK_CSUM); + + byte Digest[SHA256_DIGEST_SIZE]; + sha256_get(hd->PswCheck, SIZE_PSWCHECK, Digest); + + hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0; + + // RAR 5.21 and earlier set PswCheck field in service records to 0 + // even if UsePswCheck was present. + if (bb->HeaderType==HEAD_SERVICE && memcmp(hd->PswCheck,"\0\0\0\0\0\0\0\0",SIZE_PSWCHECK)==0) + hd->UsePswCheck=0; + } + hd->SaltSet=true; + hd->CryptMethod=CRYPT_RAR50; + hd->Encrypted=true; } - hd->SaltSet=true; - hd->CryptMethod=CRYPT_RAR50; - hd->Encrypted=true; } } break; Modified: trunk/OpenMPT/include/unrar/cmddata.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/cmddata.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/cmddata.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -426,7 +426,7 @@ break; case '4': // Convert slashes here than before every comparison. - SlashToNative(Switch+3,ArcPath); + SlashToNative(Switch+3,ExclArcPath); break; default: BadSwitch(Switch); Modified: trunk/OpenMPT/include/unrar/crypt.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/crypt.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/crypt.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -60,6 +60,8 @@ WideToChar(PwdW,PwdA,ASIZE(PwdA)); PwdA[Min(MAXPASSWORD_RAR,MAXPASSWORD)-1]=0; // For compatibility with existing archives. + bool Success=true; + switch(Method) { #ifndef SFX_MODULE @@ -77,12 +79,12 @@ SetKey30(Encrypt,Password,PwdW,Salt); break; case CRYPT_RAR50: - SetKey50(Encrypt,Password,PwdW,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + Success=SetKey50(Encrypt,Password,PwdW,Salt,InitV,Lg2Cnt,HashKey,PswCheck); break; } cleandata(PwdA,sizeof(PwdA)); cleandata(PwdW,sizeof(PwdW)); - return true; + return Success; } Modified: trunk/OpenMPT/include/unrar/crypt.hpp ============================================================================== --- trunk/OpenMPT/include/unrar/crypt.hpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/crypt.hpp Sat Jun 8 23:18:13 2024 (r20974) @@ -79,7 +79,7 @@ void DecryptBlock20(byte *Buf); void SetKey30(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt); - void SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck); + bool SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW,const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck); KDF3CacheItem KDF3Cache[4]; uint KDF3CachePos; Modified: trunk/OpenMPT/include/unrar/crypt5.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/crypt5.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/crypt5.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -128,20 +128,12 @@ } -void CryptData::SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW, +bool CryptData::SetKey50(bool Encrypt,SecPassword *Password,const wchar *PwdW, const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey, byte *PswCheck) { if (Lg2Cnt>CRYPT5_KDF_LG2_COUNT_MAX) - { - // Initialize these fields to prevent uninitialized data access warnings - // by analyzing tools when accessing returned data. - if (HashKey!=nullptr) - memset(HashKey,0,SHA256_DIGEST_SIZE); - if (PswCheck!=nullptr) - memset(PswCheck,0,SIZE_PSWCHECK); - return; - } + return false; byte Key[32],PswCheckValue[SHA256_DIGEST_SIZE],HashKeyValue[SHA256_DIGEST_SIZE]; bool Found=false; @@ -194,6 +186,7 @@ rin.Init(Encrypt, Key, 256, InitV); cleandata(Key,sizeof(Key)); + return true; } Modified: trunk/OpenMPT/include/unrar/extract.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/extract.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/extract.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -586,14 +586,14 @@ #endif byte PswCheck[SIZE_PSWCHECK]; - DataIO.SetEncryption(false,Arc.FileHead.CryptMethod,&FilePassword, - Arc.FileHead.SaltSet ? Arc.FileHead.Salt:NULL, + bool EncSet=DataIO.SetEncryption(false,Arc.FileHead.CryptMethod, + &FilePassword,Arc.FileHead.SaltSet ? Arc.FileHead.Salt:nullptr, Arc.FileHead.InitV,Arc.FileHead.Lg2Count, Arc.FileHead.HashKey,PswCheck); // If header is damaged, we cannot rely on password check value, // because it can be damaged too. - if (Arc.FileHead.UsePswCheck && !Arc.BrokenHeader && + if (EncSet && Arc.FileHead.UsePswCheck && !Arc.BrokenHeader && memcmp(Arc.FileHead.PswCheck,PswCheck,SIZE_PSWCHECK)!=0) { if (GlobalPassword) // For -p<pwd> or Ctrl+P to avoid the infinite loop. @@ -968,7 +968,7 @@ if (SetTimeAndSize) { - // We could preallocate more space that really written to broken file + // We could preallocate more space than really written to broken file // or file with crafted header. if (Preallocated>0 && (BrokenFile || DataIO.CurUnpWrite!=Preallocated)) CurFile.Truncate(); Modified: trunk/OpenMPT/include/unrar/filefn.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/filefn.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/filefn.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -239,8 +239,9 @@ { #if defined(_UNIX) && defined(S_ISFIFO) && defined(S_ISSOCK) && defined(S_ISCHR) return S_ISFIFO(Attr) || S_ISSOCK(Attr) || S_ISCHR(Attr); -#endif +#else return false; +#endif } Modified: trunk/OpenMPT/include/unrar/isnt.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/isnt.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/isnt.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -40,7 +40,7 @@ IWbemServices *pSvc = NULL; - hres = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"),NULL,NULL,NULL,NULL,0,0,&pSvc); + hres = pLoc->ConnectServer(_bstr_t(L"ROOT\\CIMV2"),NULL,NULL,NULL,0,NULL,NULL,&pSvc); if (FAILED(hres)) { Modified: trunk/OpenMPT/include/unrar/options.hpp ============================================================================== --- trunk/OpenMPT/include/unrar/options.hpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/options.hpp Sat Jun 8 23:18:13 2024 (r20974) @@ -33,7 +33,7 @@ RECURSE_NONE=0, // no recurse switches RECURSE_DISABLE, // switch -r- RECURSE_ALWAYS, // switch -r - RECURSE_WILDCARDS, // switch -r0 + RECURSE_WILDCARDS // switch -r0 }; enum OVERWRITE_MODE Modified: trunk/OpenMPT/include/unrar/os.hpp ============================================================================== --- trunk/OpenMPT/include/unrar/os.hpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/os.hpp Sat Jun 8 23:18:13 2024 (r20974) @@ -11,6 +11,7 @@ #include <new> #include <string> #include <vector> +#include <deque> #include <memory> // For automatic pointers. @@ -215,6 +216,10 @@ #endif #endif +#ifdef __VMS +# define LITTLE_ENDIAN +#endif + // Unlike Apple x64, utimensat shall be available in all Apple M1 systems. #if _POSIX_C_SOURCE >= 200809L || defined(__APPLE__) && defined(__arm64__) #define UNIX_TIME_NS // Nanosecond time precision in Unix. Modified: trunk/OpenMPT/include/unrar/rdwrfn.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/rdwrfn.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/rdwrfn.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -249,15 +249,24 @@ } -void ComprDataIO::SetEncryption(bool Encrypt,CRYPT_METHOD Method, +// Return true if encryption or decryption mode is set correctly. +bool ComprDataIO::SetEncryption(bool Encrypt,CRYPT_METHOD Method, SecPassword *Password,const byte *Salt,const byte *InitV, uint Lg2Cnt,byte *HashKey,byte *PswCheck) { -#ifndef RAR_NOCRYPT +#ifdef RAR_NOCRYPT + return false; +#else if (Encrypt) + { Encryption=Crypt->SetCryptKeys(true,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + return Encryption; + } else + { Decryption=Decrypt->SetCryptKeys(false,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck); + return Decryption; + } #endif } Modified: trunk/OpenMPT/include/unrar/rdwrfn.hpp ============================================================================== --- trunk/OpenMPT/include/unrar/rdwrfn.hpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/rdwrfn.hpp Sat Jun 8 23:18:13 2024 (r20974) @@ -66,7 +66,7 @@ void SetFiles(File *SrcFile,File *DestFile); void SetCommand(CmdAdd *Cmd) {Command=Cmd;} void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;} - void SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password, + bool SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password, const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck); void SetCmt13Encryption(); void SetUnpackToMemory(byte *Addr,uint Size); Modified: trunk/OpenMPT/include/unrar/rijndael.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/rijndael.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/rijndael.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -84,6 +84,7 @@ { if (S5[0]==0) GenerateTables(); + m_uRounds = 0; CBCMode = true; // Always true for RAR. #ifdef USE_SSE AES_NI=false; Modified: trunk/OpenMPT/include/unrar/unpack15.cpp ============================================================================== --- trunk/OpenMPT/include/unrar/unpack15.cpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/unpack15.cpp Sat Jun 8 23:18:13 2024 (r20974) @@ -474,7 +474,8 @@ void Unpack::CopyString15(uint Distance,uint Length) { DestUnpSize-=Length; - if (!FirstWinDone && Distance>UnpPtr || Distance>MaxWinSize) + // 2024.04.18: Distance can be 0 in corrupt RAR 1.5 archives. + if (!FirstWinDone && Distance>UnpPtr || Distance>MaxWinSize || Distance==0) while (Length-- > 0) { Window[UnpPtr]=0; Modified: trunk/OpenMPT/include/unrar/version.hpp ============================================================================== --- trunk/OpenMPT/include/unrar/version.hpp Sat Jun 8 21:18:08 2024 (r20973) +++ trunk/OpenMPT/include/unrar/version.hpp Sat Jun 8 23:18:13 2024 (r20974) @@ -1,6 +1,6 @@ #define RARVER_MAJOR 7 -#define RARVER_MINOR 0 +#define RARVER_MINOR 1 #define RARVER_BETA 0 -#define RARVER_DAY 26 -#define RARVER_MONTH 2 +#define RARVER_DAY 12 +#define RARVER_MONTH 5 #define RARVER_YEAR 2024 |
From: <sv...@op...> - 2024-06-08 19:18:15
|
Author: manx Date: Sat Jun 8 21:18:08 2024 New Revision: 20973 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20973 Log: [Ref] build: Autotools: Cleanup tar flavour handling. Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh ============================================================================== --- trunk/OpenMPT/build/autotools/autoconfiscate.sh Sat Jun 8 20:28:53 2024 (r20972) +++ trunk/OpenMPT/build/autotools/autoconfiscate.sh Sat Jun 8 21:18:08 2024 (r20973) @@ -12,17 +12,16 @@ echo "Detecting OS ..." UNAME_S="$(uname -s)" if [[ $UNAME_S == *"BSD"* ]]; then - BSD=1 + if [[ $UNAME_S == "OpenBSD" ]]; then + TAR_FLAVOUR=bsd + else + TAR_FLAVOUR=libarchive + fi MAKE=gmake else - BSD=0 + TAR_FLAVOUR=gnu MAKE=make fi -if [[ $UNAME_S == "OpenBSD" ]]; then - OPENBSD=1 -else - OPENBSD=0 -fi echo "Gathering version ..." . libopenmpt/libopenmpt_version.mk @@ -275,13 +274,20 @@ rm -rf libopenmpt mkdir -p libopenmpt/src.autotools/$MPT_LIBOPENMPT_VERSION/ cp *.tar.gz libopenmpt/src.autotools/$MPT_LIBOPENMPT_VERSION/ -if [[ $BSD == "1" ]]; then - if [[ $OPENBSD == "1" ]]; then - tar -cv -N -f ../dist-autotools.tar libopenmpt - else - tar -cv --numeric-owner --uname "" --gname "" --uid 0 --gid 0 -f ../dist-autotools.tar libopenmpt - fi -else - tar -cv --numeric-owner --owner=0 --group=0 -f ../dist-autotools.tar libopenmpt -fi + +case $TAR_FLAVOUR in + bsd) + tar -cv -N -f ../dist-autotools.tar libopenmpt + ;; + libarchive) + tar -cv --numeric-owner --uname "" --gname "" --uid 0 --gid 0 -f ../dist-autotools.tar libopenmpt + ;; + gnu) + tar -cv --numeric-owner --owner=0 --group=0 -f ../dist-autotools.tar libopenmpt + ;; + *) + tar -cv -f ../dist-autotools.tar libopenmpt + ;; +esac + cd ../.. |
From: <sv...@op...> - 2024-06-08 18:29:05
|
Author: manx Date: Sat Jun 8 20:28:53 2024 New Revision: 20972 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20972 Log: [Fix] build: Autotools: Use ancient BSD tar on OpenBSD. Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh Modified: trunk/OpenMPT/build/autotools/autoconfiscate.sh ============================================================================== --- trunk/OpenMPT/build/autotools/autoconfiscate.sh Sat Jun 8 19:05:55 2024 (r20971) +++ trunk/OpenMPT/build/autotools/autoconfiscate.sh Sat Jun 8 20:28:53 2024 (r20972) @@ -18,6 +18,11 @@ BSD=0 MAKE=make fi +if [[ $UNAME_S == "OpenBSD" ]]; then + OPENBSD=1 +else + OPENBSD=0 +fi echo "Gathering version ..." . libopenmpt/libopenmpt_version.mk @@ -271,9 +276,12 @@ mkdir -p libopenmpt/src.autotools/$MPT_LIBOPENMPT_VERSION/ cp *.tar.gz libopenmpt/src.autotools/$MPT_LIBOPENMPT_VERSION/ if [[ $BSD == "1" ]]; then - tar -cv --numeric-owner --uname "" --gname "" --uid 0 --gid 0 -f ../dist-autotools.tar libopenmpt + if [[ $OPENBSD == "1" ]]; then + tar -cv -N -f ../dist-autotools.tar libopenmpt + else + tar -cv --numeric-owner --uname "" --gname "" --uid 0 --gid 0 -f ../dist-autotools.tar libopenmpt + fi else tar -cv --numeric-owner --owner=0 --group=0 -f ../dist-autotools.tar libopenmpt fi cd ../.. - |
From: <sv...@op...> - 2024-06-08 17:06:02
|
Author: manx Date: Sat Jun 8 19:05:55 2024 New Revision: 20971 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20971 Log: [Imp] build: CI: GitHub: CPA: OpenBSD: Add Autotools builder. Added: trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml - copied, changed from r20968, trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Copied and modified: trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml (from r20968, trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml) ============================================================================== --- trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Sat Jun 8 18:24:04 2024 (r20968, copy source) +++ trunk/OpenMPT/.github/workflows/OpenBSD-Autotools.yml Sat Jun 8 19:05:55 2024 (r20971) @@ -1,4 +1,4 @@ -name: OpenBSD Makefile +name: OpenBSD Autotools on: push: @@ -13,15 +13,11 @@ fail-fast: false matrix: include: - - { version: '7.5', deps: sys } - - { version: '7.5', deps: local } - - { version: '7.5', deps: small } - - { version: '7.4', deps: sys } - - { version: '7.4', deps: local } - - { version: '7.4', deps: small } + - { version: '7.5' } + - { version: '7.4' } concurrency: - group: ${{github.ref}}-${{github.workflow}}-${{matrix.version}}-${{matrix.deps}} + group: ${{github.ref}}-${{github.workflow}}-${{matrix.version}}-autotools cancel-in-progress: true runs-on: ubuntu-22.04 @@ -68,20 +64,7 @@ sync_files: false shutdown_vm: false run: | - gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} - - name: Test - uses: cross-platform-actions/action@v0.24.0 - with: - architecture: x86_64 - hypervisor: qemu - memory: 4G - operating_system: openbsd - version: ${{matrix.version}} - shell: bash - sync_files: false - shutdown_vm: false - run: | - gmake -j$(sysctl -n hw.ncpu) STRICT=1 VERBOSE=1 ${{ (matrix.deps == 'sys') && 'AUTO_DEPS=1' || (matrix.deps == 'local') && 'LOCAL_ZLIB=1 LOCAL_MPG123=1 LOCAL_OGG=1 LOCAL_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' || 'NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_SDL2=1 NO_FLAC=1 NO_SNDFILE=1' }} check + export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ${{ (matrix.version == '7.5') && 'export AUTOCONF_VERSION=2.71' || (matrix.version == '7.4') && 'export AUTOCONF_VERSION=2.71' || '' }} ; ${{ (matrix.version == '7.5') && 'export AUTOMAKE_VERSION=1.16' || (matrix.version == '7.4') && 'export AUTOMAKE_VERSION=1.16' || '' }} ;./build/autotools/autoconfiscate.sh - name: Shutdown VM uses: cross-platform-actions/action@v0.24.0 with: |
From: <sv...@op...> - 2024-06-08 16:53:04
|
Author: manx Date: Sat Jun 8 18:52:52 2024 New Revision: 20970 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20970 Log: Merged revision(s) 20969 from trunk/OpenMPT: [Imp] build: CI: GitHub: CPA: FreeBSD: Autotools: Enable parallel make. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml Modified: branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml Sat Jun 8 18:50:31 2024 (r20969) +++ branches/OpenMPT-1.31/.github/workflows/FreeBSD-Autotools.yml Sat Jun 8 18:52:52 2024 (r20970) @@ -60,7 +60,7 @@ sync_files: false shutdown_vm: false run: | - ./build/autotools/autoconfiscate.sh + export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ./build/autotools/autoconfiscate.sh - name: Shutdown VM uses: cross-platform-actions/action@v0.24.0 with: |
From: <sv...@op...> - 2024-06-08 16:50:43
|
Author: manx Date: Sat Jun 8 18:50:31 2024 New Revision: 20969 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20969 Log: [Imp] build: CI: GitHub: CPA: FreeBSD: Autotools: Enable parallel make. Modified: trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml Modified: trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml Sat Jun 8 18:24:04 2024 (r20968) +++ trunk/OpenMPT/.github/workflows/FreeBSD-Autotools.yml Sat Jun 8 18:50:31 2024 (r20969) @@ -62,7 +62,7 @@ sync_files: false shutdown_vm: false run: | - ./build/autotools/autoconfiscate.sh + export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"; ./build/autotools/autoconfiscate.sh - name: Shutdown VM uses: cross-platform-actions/action@v0.24.0 with: |
From: <sv...@op...> - 2024-06-08 16:24:16
|
Author: manx Date: Sat Jun 8 18:24:04 2024 New Revision: 20968 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20968 Log: [Fix] build: CI: GitHub: CPA: OpenBSD pkg_add cannot automatically install any ambiguous package versions, we need to explicitly pick a version. [Fix] build: CI: GitHub: CPA: Force non-interactive mode for OpenBSD pkg_add. Modified: branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml Modified: branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml ============================================================================== --- branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml Sat Jun 8 18:22:39 2024 (r20967) +++ branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.4-Makefile.yml Sat Jun 8 18:24:04 2024 (r20968) @@ -40,7 +40,9 @@ sync_files: false shutdown_vm: false run: | - sudo pkg_add subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 + sudo pkg_add -I ghostscript-10.02.0 + sudo pkg_add -I autoconf-2.71 automake-1.16.5 + sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build uses: cross-platform-actions/action@v0.24.0 with: Modified: branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml ============================================================================== --- branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml Sat Jun 8 18:22:39 2024 (r20967) +++ branches/OpenMPT-1.30/.github/workflows/OpenBSD-7.5-Makefile.yml Sat Jun 8 18:24:04 2024 (r20968) @@ -40,7 +40,9 @@ sync_files: false shutdown_vm: false run: | - sudo pkg_add subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 + sudo pkg_add -I ghostscript-10.03.1 + sudo pkg_add -I autoconf-2.71 automake-1.16.5 + sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build uses: cross-platform-actions/action@v0.24.0 with: |
From: <sv...@op...> - 2024-06-08 16:22:46
|
Author: manx Date: Sat Jun 8 18:22:39 2024 New Revision: 20967 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20967 Log: Merged revision(s) 20966 from trunk/OpenMPT: [Fix] build: CI: GitHub: CPA: OpenBSD pkg_add cannot automatically install any ambiguous package versions, we need to explicitly pick a version. [Fix] build: CI: GitHub: CPA: Force non-interactive mode for OpenBSD pkg_add. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml Modified: branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml ============================================================================== --- branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml Sat Jun 8 18:22:14 2024 (r20966) +++ branches/OpenMPT-1.31/.github/workflows/OpenBSD-Makefile.yml Sat Jun 8 18:22:39 2024 (r20967) @@ -51,7 +51,9 @@ sync_files: false shutdown_vm: false run: | - sudo pkg_add subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 + sudo pkg_add -I ${{ (matrix.version == '7.5') && 'ghostscript-10.03.1' || (matrix.version == '7.4') && 'ghostscript-10.02.0' || 'ghostscript' }} + sudo pkg_add -I ${{ (matrix.version == '7.5') && 'autoconf-2.71 automake-1.16.5' || (matrix.version == '7.4') && 'autoconf-2.71 automake-1.16.5' || 'autoconf automake' }} + sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build uses: cross-platform-actions/action@v0.24.0 with: |
From: <sv...@op...> - 2024-06-08 16:22:21
|
Author: manx Date: Sat Jun 8 18:22:14 2024 New Revision: 20966 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20966 Log: [Fix] build: CI: GitHub: CPA: OpenBSD pkg_add cannot automatically install any ambiguous package versions, we need to explicitly pick a version. [Fix] build: CI: GitHub: CPA: Force non-interactive mode for OpenBSD pkg_add. Modified: trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Modified: trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml ============================================================================== --- trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Sat Jun 8 16:14:12 2024 (r20965) +++ trunk/OpenMPT/.github/workflows/OpenBSD-Makefile.yml Sat Jun 8 18:22:14 2024 (r20966) @@ -53,7 +53,9 @@ sync_files: false shutdown_vm: false run: | - sudo pkg_add subversion p5-XML-XPath git mawk gmake pkgconf autoconf autoconf-archive automake libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 + sudo pkg_add -I ${{ (matrix.version == '7.5') && 'ghostscript-10.03.1' || (matrix.version == '7.4') && 'ghostscript-10.02.0' || 'ghostscript' }} + sudo pkg_add -I ${{ (matrix.version == '7.5') && 'autoconf-2.71 automake-1.16.5' || (matrix.version == '7.4') && 'autoconf-2.71 automake-1.16.5' || 'autoconf automake' }} + sudo pkg_add -I subversion p5-XML-XPath git mawk gmake pkgconf autoconf-archive libtool libltdl help2man doxygen mpg123 libogg libvorbis flac libsndfile pulseaudio portaudio-svn sdl2 - name: Build uses: cross-platform-actions/action@v0.24.0 with: |
From: <sv...@op...> - 2024-06-08 14:14:23
|
Author: sagamusix Date: Sat Jun 8 16:14:12 2024 New Revision: 20965 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20965 Log: [Fix] XM/MO3: Don't change channel count when finding ChnS extended song property. Modified: trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/soundlib/Load_it.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp Sat Jun 8 16:09:02 2024 (r20964) +++ trunk/OpenMPT/soundlib/Load_it.cpp Sat Jun 8 16:14:12 2024 (r20965) @@ -2503,10 +2503,11 @@ case MagicBE("ChnS"): // Channel settings for channels 65+ static_assert(MAX_BASECHANNELS >= 64); - if(size <= (MAX_BASECHANNELS - 64) * 2 && (size % 2u) == 0) + if(size <= (MAX_BASECHANNELS - 64) * 2 && (size % 2u) == 0 && (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) { const CHANNELINDEX channelsInFile = mpt::saturate_cast<CHANNELINDEX>(64 + size / 2); - ChnSettings.resize(std::clamp(GetNumChannels(), channelsInFile, MAX_BASECHANNELS)); + if(!ignoreChannelCount) + ChnSettings.resize(std::clamp(GetNumChannels(), channelsInFile, MAX_BASECHANNELS)); const CHANNELINDEX loopLimit = std::min(channelsInFile, GetNumChannels()); for(CHANNELINDEX chn = 64; chn < loopLimit; chn++) { |
From: <sv...@op...> - 2024-06-08 14:09:13
|
Author: sagamusix Date: Sat Jun 8 16:09:02 2024 New Revision: 20964 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20964 Log: Merged revision(s) 20960 from trunk/OpenMPT: [Fix] MO3: Don't try to load comrpessed samples if the header says that it's a 0-length sample anyway. This may cause a sample buffer to be allocated and its size be reduced to 0, which is an API violation (see assertion in ModSample::HasSampleData()). Found with afl++. ........ Modified: branches/OpenMPT-1.28/ (props changed) branches/OpenMPT-1.28/soundlib/Load_mo3.cpp Modified: branches/OpenMPT-1.28/soundlib/Load_mo3.cpp ============================================================================== --- branches/OpenMPT-1.28/soundlib/Load_mo3.cpp Sat Jun 8 16:08:14 2024 (r20963) +++ branches/OpenMPT-1.28/soundlib/Load_mo3.cpp Sat Jun 8 16:09:02 2024 (r20964) @@ -1346,6 +1346,8 @@ if(smpHeader.flags & MO3Sample::smpStereo) sample.uFlags.set(CHN_STEREO); FileReader sampleData = file.ReadChunk(smpHeader.compressedSize); + if(!smpHeader.length) + continue; const uint8 numChannels = sample.GetNumChannels(); if(compression == MO3Sample::smpDeltaCompression || compression == MO3Sample::smpDeltaPrediction) |
From: <sv...@op...> - 2024-06-08 14:08:20
|
Author: sagamusix Date: Sat Jun 8 16:08:14 2024 New Revision: 20963 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20963 Log: Merged revision(s) 20960 from trunk/OpenMPT: [Fix] MO3: Don't try to load comrpessed samples if the header says that it's a 0-length sample anyway. This may cause a sample buffer to be allocated and its size be reduced to 0, which is an API violation (see assertion in ModSample::HasSampleData()). Found with afl++. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/soundlib/Load_mo3.cpp Modified: branches/OpenMPT-1.29/soundlib/Load_mo3.cpp ============================================================================== --- branches/OpenMPT-1.29/soundlib/Load_mo3.cpp Sat Jun 8 16:07:21 2024 (r20962) +++ branches/OpenMPT-1.29/soundlib/Load_mo3.cpp Sat Jun 8 16:08:14 2024 (r20963) @@ -1360,6 +1360,8 @@ sample.uFlags.set(CHN_STEREO); FileReader sampleData = file.ReadChunk(smpHeader.compressedSize); + if(!smpHeader.length) + continue; const uint8 numChannels = sample.GetNumChannels(); if(compression == MO3Sample::smpDeltaCompression || compression == MO3Sample::smpDeltaPrediction) |
From: <sv...@op...> - 2024-06-08 14:07:32
|
Author: sagamusix Date: Sat Jun 8 16:07:21 2024 New Revision: 20962 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20962 Log: Merged revision(s) 20960 from trunk/OpenMPT: [Fix] MO3: Don't try to load comrpessed samples if the header says that it's a 0-length sample anyway. This may cause a sample buffer to be allocated and its size be reduced to 0, which is an API violation (see assertion in ModSample::HasSampleData()). Found with afl++. ........ Modified: branches/OpenMPT-1.30/ (props changed) branches/OpenMPT-1.30/soundlib/Load_mo3.cpp Modified: branches/OpenMPT-1.30/soundlib/Load_mo3.cpp ============================================================================== --- branches/OpenMPT-1.30/soundlib/Load_mo3.cpp Sat Jun 8 16:05:17 2024 (r20961) +++ branches/OpenMPT-1.30/soundlib/Load_mo3.cpp Sat Jun 8 16:07:21 2024 (r20962) @@ -1360,6 +1360,8 @@ sample.uFlags.set(CHN_STEREO); FileReader sampleData = file.ReadChunk(smpHeader.compressedSize); + if(!smpHeader.length) + continue; const uint8 numChannels = sample.GetNumChannels(); if(compression == MO3Sample::smpDeltaCompression || compression == MO3Sample::smpDeltaPrediction) |
From: <sv...@op...> - 2024-06-08 14:05:28
|
Author: sagamusix Date: Sat Jun 8 16:05:17 2024 New Revision: 20961 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20961 Log: Merged revision(s) 20960 from trunk/OpenMPT: [Fix] MO3: Don't try to load comrpessed samples if the header says that it's a 0-length sample anyway. This may cause a sample buffer to be allocated and its size be reduced to 0, which is an API violation (see assertion in ModSample::HasSampleData()). Found with afl++. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/soundlib/Load_mo3.cpp Modified: branches/OpenMPT-1.31/soundlib/Load_mo3.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_mo3.cpp Sat Jun 8 15:59:29 2024 (r20960) +++ branches/OpenMPT-1.31/soundlib/Load_mo3.cpp Sat Jun 8 16:05:17 2024 (r20961) @@ -1324,6 +1324,8 @@ sample.uFlags.set(CHN_STEREO); FileReader sampleData = file.ReadChunk(smpHeader.compressedSize); + if(!smpHeader.length) + continue; const uint8 numChannels = sample.GetNumChannels(); if(compression == MO3Sample::smpDeltaCompression || compression == MO3Sample::smpDeltaPrediction) |
From: <sv...@op...> - 2024-06-08 13:59:36
|
Author: sagamusix Date: Sat Jun 8 15:59:29 2024 New Revision: 20960 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20960 Log: [Fix] MO3: Don't try to load comrpessed samples if the header says that it's a 0-length sample anyway. This may cause a sample buffer to be allocated and its size be reduced to 0, which is an API violation (see assertion in ModSample::HasSampleData()). Found with afl++. Modified: trunk/OpenMPT/soundlib/Load_mo3.cpp Modified: trunk/OpenMPT/soundlib/Load_mo3.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_mo3.cpp Sat Jun 8 15:52:52 2024 (r20959) +++ trunk/OpenMPT/soundlib/Load_mo3.cpp Sat Jun 8 15:59:29 2024 (r20960) @@ -1630,7 +1630,7 @@ } // Not a compressed sample? - if(!smpInfo.chunk.IsValid()) + if(!smpHeader.length || !smpInfo.chunk.IsValid()) continue; if(smpHeader.flags & MO3Sample::smp16Bit) |
From: <sv...@op...> - 2024-06-08 13:53:04
|
Author: sagamusix Date: Sat Jun 8 15:52:52 2024 New Revision: 20959 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20959 Log: [Fix] PSM: Don't write to ChnSettings past the last channel. Modified: trunk/OpenMPT/soundlib/Load_psm.cpp Modified: trunk/OpenMPT/soundlib/Load_psm.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_psm.cpp Sat Jun 8 15:44:28 2024 (r20958) +++ trunk/OpenMPT/soundlib/Load_psm.cpp Sat Jun 8 15:52:52 2024 (r20959) @@ -996,10 +996,10 @@ if(std::memcmp(fileHeader.formatID, "PSM\xFE", 4) || fileHeader.lineEnd != 0x1A || (fileHeader.formatVersion != 0x10 && fileHeader.formatVersion != 0x01) // why is this sometimes 0x01? - || fileHeader.patternVersion != 0 // 255ch pattern version not supported (did anyone use this?) + || fileHeader.patternVersion != 0 // 255ch pattern version not supported (does it actually exist? The pattern format is not documented) || (fileHeader.songType & 3) != 0 - || fileHeader.numChannelsPlay > MAX_BASECHANNELS - || fileHeader.numChannelsReal > MAX_BASECHANNELS + || fileHeader.numChannelsPlay > 32 + || fileHeader.numChannelsReal > 32 || std::max(fileHeader.numChannelsPlay, fileHeader.numChannelsReal) == 0) { return false; @@ -1070,7 +1070,7 @@ // Read pan positions if(fileHeader.panOffset > 4 && file.Seek(fileHeader.panOffset - 4) && file.ReadMagic("PPAN")) { - for(CHANNELINDEX i = 0; i < 32; i++) + for(CHANNELINDEX i = 0; i < GetNumChannels(); i++) { ChnSettings[i].nPan = static_cast<uint16>(((15 - (file.ReadUint8() & 0x0F)) * 256 + 8) / 15); // 15 seems to be left and 0 seems to be right... // ChnSettings[i].dwFlags = (i >= fileHeader.numChannelsPlay) ? CHN_MUTE : 0; // don't mute channels, as muted channels are completely ignored in S3M |
From: <sv...@op...> - 2024-06-08 13:44:35
|
Author: sagamusix Date: Sat Jun 8 15:44:28 2024 New Revision: 20958 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20958 Log: Merged revision(s) 20957 from trunk/OpenMPT: [Fix] DTM: Finetune needs to be handled separately for correct period calculation. Fixes the slides in AMAI.DTM by Yerzmyey (libopenmpt only). ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/soundlib/Load_dtm.cpp branches/OpenMPT-1.31/soundlib/Snd_fx.cpp Modified: branches/OpenMPT-1.31/soundlib/Load_dtm.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Load_dtm.cpp Sat Jun 8 15:43:49 2024 (r20957) +++ branches/OpenMPT-1.31/soundlib/Load_dtm.cpp Sat Jun 8 15:44:28 2024 (r20958) @@ -97,7 +97,12 @@ // In revolution to come.dtm, the file header says samples rate is 24512 Hz, but samples say it's 50000 Hz // Digital Home Studio ignores the header setting in 2.04-/2.06-style modules mptSmp.nC5Speed = (formatVersion == DTM_PT_PATTERN_FORMAT && forcedSampleRate > 0) ? forcedSampleRate : sampleRate; - int32 transposeAmount = MOD2XMFineTune(finetune); + int32 transposeAmount = 0; +#ifdef MODPLUG_TRACKER + transposeAmount = MOD2XMFineTune(finetune); +#else + mptSmp.nFineTune = MOD2XMFineTune(finetune); +#endif if(formatVersion == DTM_206_PATTERN_FORMAT && transpose > 0 && transpose != 48) { // Digital Home Studio applies this unconditionally, but some old songs sound wrong then (delirium.dtm). @@ -437,26 +442,18 @@ { m->note = note + NOTE_MIN + 12; if(position.rem) - { - m->command = CMD_MODCMDEX; - m->param = 0xD0 | static_cast<ModCommand::PARAM>(std::min(position.rem, 15)); - } + m->SetEffectCommand(CMD_MODCMDEX, static_cast<ModCommand::PARAM>(0xD0 | std::min(position.rem, 15))); } else if(note & 0x80) { // Lower 7 bits contain note, probably intended for MIDI-like note-on/note-off events if(position.rem) - { - m->command = CMD_MODCMDEX; - m->param = 0xC0 | static_cast<ModCommand::PARAM>(std::min(position.rem, 15)); - } else - { + m->SetEffectCommand(CMD_MODCMDEX, static_cast<ModCommand::PARAM>(0xC0 |std::min(position.rem, 15))); + else m->note = NOTE_NOTECUT; - } } if(volume) { - m->volcmd = VOLCMD_VOLUME; - m->vol = std::min(volume, uint8(64)); // Volume can go up to 255, but we do not support over-amplification at the moment. + m->SetVolumeCommand(VOLCMD_VOLUME, std::min(volume, uint8(64))); // Volume can go up to 255, but we do not support over-amplification at the moment. } if(instr) { Modified: branches/OpenMPT-1.31/soundlib/Snd_fx.cpp ============================================================================== --- branches/OpenMPT-1.31/soundlib/Snd_fx.cpp Sat Jun 8 15:43:49 2024 (r20957) +++ branches/OpenMPT-1.31/soundlib/Snd_fx.cpp Sat Jun 8 15:44:28 2024 (r20958) @@ -6152,11 +6152,16 @@ note -= NOTE_MIN; if(!UseFinetuneAndTranspose()) { - if(GetType() & (MOD_TYPE_MDL | MOD_TYPE_DTM)) + if(GetType() == MOD_TYPE_MDL) { // MDL uses non-linear slides, but their effectiveness does not depend on the middle-C frequency. MPT_ASSERT(!PeriodsAreFrequencies()); return (FreqS3MTable[note % 12u] << 4) >> (note / 12); + } else if(GetType() == MOD_TYPE_DTM) + { + // Similar to MDL, but finetune is factored in and we don't transpose everything by an octave + MPT_ASSERT(!PeriodsAreFrequencies()); + return (ProTrackerTunedPeriods[XM2MODFineTune(nFineTune) * 12u + note % 12u] << 5) >> (note / 12u); } if(!nC5Speed) nC5Speed = 8363; @@ -6272,7 +6277,7 @@ { // We only really use c5speed for the finetune pattern command. All samples in 669 files have the same middle-C speed (imported as 8363 Hz). return (period + c5speed - 8363) << FREQ_FRACBITS; - } else if(GetType() & (MOD_TYPE_MDL | MOD_TYPE_DTM)) + } else if(GetType() == MOD_TYPE_MDL) { MPT_ASSERT(!PeriodsAreFrequencies()); LimitMax(period, Util::MaxValueOfType(period) >> 8); @@ -6286,7 +6291,7 @@ // Input is already a frequency in Hertz, not a period. static_assert(FREQ_FRACBITS <= 8, "Check this shift operator"); return uint32(((uint64(period) << 8) + nPeriodFrac) >> (8 - FREQ_FRACBITS)); - } else if(m_SongFlags[SONG_LINEARSLIDES]) + } else if(m_SongFlags[SONG_LINEARSLIDES] || GetType() == MOD_TYPE_DTM) { if(!c5speed) c5speed = 8363; |
From: <sv...@op...> - 2024-06-08 13:44:01
|
Author: sagamusix Date: Sat Jun 8 15:43:49 2024 New Revision: 20957 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20957 Log: [Fix] DTM: Finetune needs to be handled separately for correct period calculation. Fixes the slides in AMAI.DTM by Yerzmyey (libopenmpt only). Modified: trunk/OpenMPT/soundlib/Load_dtm.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Load_dtm.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_dtm.cpp Sat Jun 8 14:35:12 2024 (r20956) +++ trunk/OpenMPT/soundlib/Load_dtm.cpp Sat Jun 8 15:43:49 2024 (r20957) @@ -97,7 +97,12 @@ // In revolution to come.dtm, the file header says samples rate is 24512 Hz, but samples say it's 50000 Hz // Digital Home Studio ignores the header setting in 2.04-/2.06-style modules mptSmp.nC5Speed = (formatVersion == DTM_PT_PATTERN_FORMAT && forcedSampleRate > 0) ? forcedSampleRate : sampleRate; - int32 transposeAmount = MOD2XMFineTune(finetune); + int32 transposeAmount = 0; +#ifdef MODPLUG_TRACKER + transposeAmount = MOD2XMFineTune(finetune); +#else + mptSmp.nFineTune = MOD2XMFineTune(finetune); +#endif if(formatVersion == DTM_206_PATTERN_FORMAT && transpose > 0 && transpose != 48) { // Digital Home Studio applies this unconditionally, but some old songs sound wrong then (delirium.dtm). @@ -436,26 +441,18 @@ { m->note = note + NOTE_MIN + 12; if(position.rem) - { - m->command = CMD_MODCMDEX; - m->param = 0xD0 | static_cast<ModCommand::PARAM>(std::min(position.rem, 15)); - } + m->SetEffectCommand(CMD_MODCMDEX, static_cast<ModCommand::PARAM>(0xD0 | std::min(position.rem, 15))); } else if(note & 0x80) { // Lower 7 bits contain note, probably intended for MIDI-like note-on/note-off events if(position.rem) - { - m->command = CMD_MODCMDEX; - m->param = 0xC0 | static_cast<ModCommand::PARAM>(std::min(position.rem, 15)); - } else - { + m->SetEffectCommand(CMD_MODCMDEX, static_cast<ModCommand::PARAM>(0xC0 |std::min(position.rem, 15))); + else m->note = NOTE_NOTECUT; - } } if(volume) { - m->volcmd = VOLCMD_VOLUME; - m->vol = std::min(volume, uint8(64)); // Volume can go up to 255, but we do not support over-amplification at the moment. + m->SetVolumeCommand(VOLCMD_VOLUME, std::min(volume, uint8(64))); // Volume can go up to 255, but we do not support over-amplification at the moment. } if(instr) { Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Sat Jun 8 14:35:12 2024 (r20956) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Sat Jun 8 15:43:49 2024 (r20957) @@ -6505,11 +6505,16 @@ note -= NOTE_MIN; if(!UseFinetuneAndTranspose()) { - if(GetType() & (MOD_TYPE_MDL | MOD_TYPE_DTM)) + if(GetType() == MOD_TYPE_MDL) { // MDL uses non-linear slides, but their effectiveness does not depend on the middle-C frequency. MPT_ASSERT(!PeriodsAreFrequencies()); return (FreqS3MTable[note % 12u] << 4) >> (note / 12); + } else if(GetType() == MOD_TYPE_DTM) + { + // Similar to MDL, but finetune is factored in and we don't transpose everything by an octave + MPT_ASSERT(!PeriodsAreFrequencies()); + return (ProTrackerTunedPeriods[XM2MODFineTune(nFineTune) * 12u + note % 12u] << 5) >> (note / 12u); } if(!nC5Speed) nC5Speed = 8363; @@ -6625,7 +6630,7 @@ { // We only really use c5speed for the finetune pattern command. All samples in 669 files have the same middle-C speed (imported as 8363 Hz). return (period + c5speed - 8363) << FREQ_FRACBITS; - } else if(GetType() & (MOD_TYPE_MDL | MOD_TYPE_DTM)) + } else if(GetType() == MOD_TYPE_MDL) { MPT_ASSERT(!PeriodsAreFrequencies()); LimitMax(period, Util::MaxValueOfType(period) >> 8); @@ -6639,7 +6644,7 @@ // Input is already a frequency in Hertz, not a period. static_assert(FREQ_FRACBITS <= 8, "Check this shift operator"); return uint32(((uint64(period) << 8) + nPeriodFrac) >> (8 - FREQ_FRACBITS)); - } else if(m_SongFlags[SONG_LINEARSLIDES]) + } else if(m_SongFlags[SONG_LINEARSLIDES] || GetType() == MOD_TYPE_DTM) { if(!c5speed) c5speed = 8363; |
From: <sv...@op...> - 2024-06-08 12:35:19
|
Author: sagamusix Date: Sat Jun 8 14:35:12 2024 New Revision: 20956 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20956 Log: [Fix] GT2: Don't write to ChnSettings past the last channel. Modified: trunk/OpenMPT/soundlib/Load_gt2.cpp Modified: trunk/OpenMPT/soundlib/Load_gt2.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_gt2.cpp Sat Jun 8 14:24:39 2024 (r20955) +++ trunk/OpenMPT/soundlib/Load_gt2.cpp Sat Jun 8 14:35:12 2024 (r20956) @@ -1259,7 +1259,8 @@ { // Only channel mute status is of interest here uint32 muteStatus = chunk.ReadUint32BE(); - for(CHANNELINDEX i = 0; i < 32; i++) + const CHANNELINDEX numChannels = std::min(GetNumChannels(), CHANNELINDEX(32)); + for(CHANNELINDEX i = 0; i < numChannels; i++) { ChnSettings[i].dwFlags.set(CHN_MUTE, !(muteStatus & (1u << i))); } |
From: <sv...@op...> - 2024-06-08 12:24:52
|
Author: sagamusix Date: Sat Jun 8 14:24:39 2024 New Revision: 20955 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20955 Log: [Fix] S3M: Don't write to ChnSettings past the last channel. Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp Sat Jun 8 14:21:22 2024 (r20954) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp Sat Jun 8 14:24:39 2024 (r20955) @@ -487,15 +487,12 @@ { bool hasChannelsWithoutPanning = false; const auto pan = file.ReadArray<uint8, 32>(); - for(CHANNELINDEX i = 0; i < 32; i++) + for(CHANNELINDEX i = 0; i < GetNumChannels(); i++) { if((pan[i] & 0x20) != 0 && (!isST3 || !isAdlibChannel[i])) - { ChnSettings[i].nPan = static_cast<uint16>((static_cast<uint16>(pan[i] & 0x0F) * 256 + 8) / 15u); - } else if(pan[i] < 0x10) - { + else if(pan[i] < 0x10) hasChannelsWithoutPanning = true; - } } if(GetNumChannels() < 32 && m_dwLastSavedWithVersion == MPT_V("1.16")) { |
From: <sv...@op...> - 2024-06-08 12:21:34
|
Author: sagamusix Date: Sat Jun 8 14:21:22 2024 New Revision: 20954 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20954 Log: [Fix] AMF: Don't write to ChnSettings past the last channel. Modified: trunk/OpenMPT/soundlib/Load_amf.cpp Modified: trunk/OpenMPT/soundlib/Load_amf.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_amf.cpp Sat Jun 8 12:24:36 2024 (r20953) +++ trunk/OpenMPT/soundlib/Load_amf.cpp Sat Jun 8 14:21:22 2024 (r20954) @@ -238,6 +238,8 @@ return false; if(version < 9) return true; + if(version < 12) + return (numChannels >= 1 && numChannels <= 16); return (numChannels >= 1 && numChannels <= 32); } @@ -600,14 +602,15 @@ if(fileSignature.version >= 11) { const CHANNELINDEX readChannels = fileSignature.version >= 12 ? 32 : 16; - for(CHANNELINDEX chn = 0; chn < readChannels; chn++) + for(auto &chn : ChnSettings) { int8 pan = file.ReadInt8(); if(pan == 100) - ChnSettings[chn].dwFlags = CHN_SURROUND; + chn.dwFlags = CHN_SURROUND; else - ChnSettings[chn].nPan = static_cast<uint16>(std::clamp((pan + 64) * 2, 0, 256)); + chn.nPan = static_cast<uint16>(std::clamp((pan + 64) * 2, 0, 256)); } + file.Skip(readChannels - GetNumChannels()); } else if(fileSignature.version >= 9) { // Internally, DSMI assigns an Amiga-like LRRL panning scheme to the channels in pre-v11 files, @@ -616,7 +619,7 @@ // This can be observed by looking at a 4-channel MOD and the converted AMF file: The last two channels are swapped. // We ignore all this mess and simply assume that all AMF files use the standard remap table. file.Skip(16); - for(CHANNELINDEX chn = 0; chn < 16; chn++) + for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { ChnSettings[chn].nPan = (chn & 1) ? 0xC0 : 0x40; } |