From f8b5408e8dd965afd8dcd06b867cda1fc7ec9935 Mon Sep 17 00:00:00 2001 From: luckyrat Date: Fri, 23 Feb 2024 11:20:09 +0000 Subject: [PATCH] Add extra format upgrade tests --- lib/src/kdbx_file.dart | 7 +++ pubspec.yaml | 2 +- test/kdbx_upgrade_test.dart | 57 ++++++++++++++++-------- test/test_files/v4.0.kdbx | Bin 0 -> 2497 bytes test/test_files/v4_1-invalid-dates.kdbx | Bin 0 -> 993 bytes 5 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 test/test_files/v4.0.kdbx create mode 100644 test/test_files/v4_1-invalid-dates.kdbx diff --git a/lib/src/kdbx_file.dart b/lib/src/kdbx_file.dart index 16b3885..7eae5aa 100644 --- a/lib/src/kdbx_file.dart +++ b/lib/src/kdbx_file.dart @@ -151,6 +151,13 @@ class KdbxFile { ? header.upgradeMinor(majorVersion, minorVersion) : header.upgrade(majorVersion, minorVersion); + // Do this even we were already in v4.x since some KDBX software (including + // earlier versions of Kee Vault) skipped this step when upgrading from `BI@nXX25sC=$OBEIuwn-g000191V5$lY8OTPUc>|9 zFCB9WivR!s00BY;0000aRaHqu5C8xG?_+J>j44D*k@u;j1LFz|LID5(08=0U006@U zCa(x7<=s^p6A7gRCml4jd$8Ee=R8d(_;%Uq*SG`$0000`1ONa40RR911pxp607(b{ z0006200000000F60000@2mk;8000mG000001OWg509FJ5000vJ00000000008DQhR zrvj)^dw9x2wZmE_Lzx^t%clyg(u(t&ey`DF4ZN}_{1|^SXxtJq*j?6#X%?t%z}=LI z4R0bSL;sD$0buUIGQZ6*dOa0r2HJ#dnG?jIAnG`fziIgcL0n&YU`oM#* zn@L-p{H-&#b;0{7z2%}~&;Q|k0IkAe@Ryx$kBmM112Maxo+cg`9VB((tT-aB;v@Lr zi6^5Vd-D2l3dwMZb~=DP7vC#LG7$*8Y*qXR);fi}Wyea^MPvXWiG!SUBtIpzU*S)u z;J_$FtL^Q$LgD!7Um%l4PUnd^Za#HFvg_bm*FHHii9F#)i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2Wy)t)3&1j?kD-DxYzT`tT8NUiUpNYI=6bqb~m_zK8>@xEr+Vr`&@psipX)hBgRcNWr z4VB?Nh@ugVv)D*R@qdGEW}!tWqg3D)Tp@-71M-YImsb9i~ryvNoa;B zMW`!LrmlnHYt?sV6xjVCPabbP>BxWx(@4` zFYS1{iEj5Yz~?8l-~-m5h1#_JqVeV)BqhO8Mi=#(A{cRrOG8F!A!)63Y%Lk02I=Fk zu~ymbekKgRu(log5OFOZ)eXbJQ>ft}!Y)JPkE=d-Lm z{pbK}-$Jnkt192wh+;pW(O-kPt+&ubgf!RqMg;_cNkfc|J!3B*QCEM)BfDWN?#tY- zqug0I>wSVY4^-rW9&hL-CNQ&ky~guf#v%aXk94!X8DQMhe;T(R3#2lH*t`QO?blz@ zOrDt`noEVDG5by^b@^dd@ev}%T+q_0(3?E~KbsL5DRt*JEbt$GGE<=VWf=}Kw}9kp z{SudGX+{bOyE=WlG|1-dXm0D3tfa%Da&J(mkc2~umX!kLqghqfBXgD^TVr%~nb9)8 zONR+E)|A{viQy@HaQrnsv;a`lt5X|ZoLA_lkz3NZ)Nn6$KfXTd2X5@;>u>3)J~44X z;>=Z#=;_c>z(gb@Ur_vfLDoLoW&N>U+*+Yfdf6sarJag-RL-74A!om%i>|B2{`|^8 zX2Hv6mN5HUUat>v>GdKL|0R>&hh-xP3!WK90*a477jS@3#9!QX-b<`7BRGL-kJmgG zow{kG1#{wOfrKfz(;&FCAaIFeE|Oh)QY3cFjI(1>@+=KBIxl1~VU_NELlJV_uNbAh zJ{d=cajR+P@F5FKQPl9sF%k+e9I7sVSf3^p)`DuJEa@*B0nnQRD>*;8V>cUo4}S}@ LHl7Rm00000h?10x literal 0 HcmV?d00001 diff --git a/test/test_files/v4_1-invalid-dates.kdbx b/test/test_files/v4_1-invalid-dates.kdbx new file mode 100644 index 0000000000000000000000000000000000000000..fa5d919844dfea1fde0a143a1077177aecac6945 GIT binary patch literal 993 zcmZR+xoB4UZ||*)3@i*x0t^fch6g`A+h6D$urGpDG3!s%e`Xe-AR`d7C;*8saWme3 zxa`VXsu|v@y*+>H-Q>2ESyHM?7$mB!Y+l)`u!D?fQJW!mlKuPKhx^}u?S0Y49l;7f;=}X1nlsENT{^t{c(cjI zJqBCPUS4m)9um-dNv7yzY1>B@kjem#*zde1q;jjA1^Ut){n~2vr$G&b}bSm-0nZq6F+`(TD zM`c$rUN~!MFeT=-OQ;@O@8U-VZhB%dX;5}1P zl^T~^^Iw4hpTCv?DF6PKeJb1U`V~2*CtkUHeOxF$Px2C1 zp#Dv^-eX2#e7erkFzvw zwy&{$`D@ASF6EMK8xqco&VBjFMlCAto|i+JGw;0zI=02T&R$w=rnm0<@{`ewlm5n^ z)l_a2d!Bgq#-^pmC;f1LFBqj&eqFzn*LKyG$#1>WCj~F$>B(bV-(7m$BC37u5vv)u zeJaClS=LDJh<`F)p1mj8vc=VHInVo9`!D~#z^43hq5QfFdEF6D94}aHyRnP$%f&AR zE&_9{ZcnZJ=CrEkMU>5%d8@OvzjrHfO6IB0 zs|%OTi}d|eTew;yZjn0MkrFK{t$2GTw~|(&gMT&6A{~^o&HprQsdI|46+2TcwzJW` zsqpNcmpi`;9s01QI&%4dhK{4w=N`?5*#0+mu1yv&0& zmMjs`FmEesx_x?Lk)oXU$_MUdRq<*@mlIUCT)X$wPN*|2bhfS5-8Ehlr@pEEmf7ac zWhqegM!(&y$?bxSwYZ(*t(KOT6|k^ JMiMBY0{~Bmsb>HH literal 0 HcmV?d00001