Fix read-from-stream flow errors
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dmitry Isaenko 2023-01-16 09:45:46 +03:00
parent 7add08c196
commit f53af3cd46
7 changed files with 143 additions and 43 deletions

View file

@ -9,7 +9,7 @@
id="svg50454"
xml:space="preserve"
sodipodi:docname="logo.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@ -25,15 +25,15 @@
inkscape:deskcolor="#505050"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="8"
inkscape:cx="102.375"
inkscape:cy="89.25"
inkscape:window-width="3754"
inkscape:window-height="2127"
inkscape:window-x="1166"
inkscape:zoom="1.9483566"
inkscape:cx="371.59522"
inkscape:cy="203.50484"
inkscape:window-width="2421"
inkscape:window-height="1641"
inkscape:window-x="99"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g934"
inkscape:current-layer="layer1-6"
showguides="false"><inkscape:grid
type="xygrid"
id="grid52390"
@ -166,7 +166,94 @@
fy="139.86536"
r="15.022657"
gradientTransform="matrix(1,0,0,0.99753429,0,0.3448673)"
gradientUnits="userSpaceOnUse" /></defs><g
gradientUnits="userSpaceOnUse" /><filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Drop Shadow"
id="filter14081"
x="-0.0078805794"
y="-0.051352299"
width="1.0157612"
height="1.1027046"><feFlood
flood-opacity="1"
flood-color="rgb(255,255,255)"
result="flood"
id="feFlood14071" /><feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite1"
id="feComposite14073" /><feGaussianBlur
in="composite1"
stdDeviation="0.5"
result="blur"
id="feGaussianBlur14075" /><feOffset
dx="0"
dy="0"
result="offset"
id="feOffset14077" /><feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="composite2"
id="feComposite14079" /></filter><filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Drop Shadow"
id="filter15545"
x="-0.039939674"
y="-0.040038397"
width="1.0798793"
height="1.0800768"><feFlood
flood-opacity="1"
flood-color="rgb(255,255,255)"
result="flood"
id="feFlood15535" /><feComposite
in="flood"
in2="SourceGraphic"
operator="in"
result="composite1"
id="feComposite15537" /><feGaussianBlur
in="composite1"
stdDeviation="0.5"
result="blur"
id="feGaussianBlur15539" /><feOffset
dx="0"
dy="0"
result="offset"
id="feOffset15541" /><feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="composite2"
id="feComposite15543" /></filter><filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Drop Shadow"
id="filter17092"
x="-0.0065458227"
y="-0.84077772"
width="1.0130916"
height="2.6815554"><feFlood
flood-opacity="1"
flood-color="rgb(255,255,255)"
result="flood"
id="feFlood17082" /><feComposite
in="SourceGraphic"
in2="flood"
operator="in"
result="composite1"
id="feComposite17084" /><feGaussianBlur
in="composite1"
stdDeviation="0.5"
result="blur"
id="feGaussianBlur17086" /><feOffset
dx="0"
dy="0"
result="offset"
id="feOffset17088" /><feComposite
in="SourceGraphic"
in2="offset"
operator="over"
result="composite2"
id="feComposite17090" /></filter></defs><g
inkscape:label="Слой 1"
inkscape:groupmode="layer"
id="layer1"><g
@ -174,7 +261,7 @@
id="layer1-6"
transform="translate(-10.216548,-123.06927)"><g
id="g934"
style="display:inline"
style="display:inline;filter:url(#filter15545)"
transform="matrix(0.90267603,0,0,0.90267603,2.660591,13.611243)"><path
id="path1766-2-3"
style="display:inline;fill:url(#radialGradient2643);fill-opacity:1;stroke:none;stroke-width:0.482744;stroke-opacity:1"
@ -194,44 +281,45 @@
d="m 22.991867,132.78946 c -0.01513,0.002 -0.02981,0.008 -0.04145,0.02 l -2.803486,2.80495 a 1.2887272,1.6475788 3.0525799 0 1 0.147784,0.73452 1.2887272,1.6475788 3.0525799 0 1 -0.382383,1.1852 l 0.833047,0.83256 c 0.02664,0.0266 0.06947,0.0266 0.09608,0 l 1.490021,-1.49052 3.992578,3.99014 -4.726615,5.4392 c -0.02471,0.0284 -0.02158,0.0709 0.0068,0.0956 l 0.602349,0.52333 c 0.02843,0.0247 0.0709,0.0221 0.0956,-0.007 l 4.684181,-5.38945 5.386029,5.38311 c 0.02663,0.0266 0.06946,0.0266 0.09608,0 l 0.564305,-0.5648 c 0.02663,-0.0266 0.02663,-0.0695 0,-0.0961 l -5.432362,-5.42894 3.739932,-4.30326 0.366774,0.31897 c 0.02842,0.0247 1.742794,0.73373 2.649361,0.82476 -0.106232,-1.00437 -1.022642,-2.63929 -1.051064,-2.66399 l -0.366773,-0.31898 0.05706,-0.0653 c 0.02472,-0.0284 0.0216,-0.0714 -0.0068,-0.0961 l -0.602836,-0.52333 c -0.02842,-0.0247 -0.0709,-0.0221 -0.0956,0.007 l -0.05706,0.0653 -1.445151,-1.25591 c -0.02842,-0.0247 -0.07139,-0.0217 -0.09608,0.007 l -1.509532,1.73682 c -0.02471,0.0284 -0.0216,0.0713 0.0068,0.0961 l 1.445638,1.25591 -3.697011,4.25351 -3.946242,-3.94429 1.682189,-1.68317 c 0.02661,-0.0266 0.02662,-0.0695 0,-0.0961 l -1.627564,-1.62659 c -0.01332,-0.0133 -0.03046,-0.02 -0.0478,-0.02 -0.0022,0 -0.0046,-1.9e-4 -0.0068,0 z" /></g><g
aria-label="libKonogonka"
id="text2788"
style="font-size:10.5833px;line-height:1.25;font-family:Terminus;-inkscape-font-specification:'Terminus, Normal';stroke-width:0.264583;filter:url(#filter3747)"><path
style="font-size:10.5833px;line-height:1.25;font-family:Terminus;-inkscape-font-specification:'Terminus, Normal';stroke-width:0.264583;fill-opacity:1;fill:#3a3a3a;filter:url(#filter14081)"><path
d="m 48.274372,147.82162 h -2.286 v -17.77999 h 2.286 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path871" /><path
d="m 54.522779,133.47062 h -2.286 v -2.38759 h 2.286 z m 0,14.351 h -2.286 v -12.2936 h 2.286 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path873" /><path
d="m 69.686586,138.75382 v 5.0546 q 0,1.1176 -0.3302,1.9304 -0.3302,0.8128 -0.8382,1.27 -0.4826,0.4318 -1.2954,0.6858 -0.8128,0.254 -1.524,0.3048 -0.7112,0.0762 -1.7272,0.0762 -1.3208,0 -2.159,-0.127 -0.8382,-0.127 -1.6764,-0.5334 -0.8382,-0.4064 -1.2446,-1.2954 -0.4064,-0.9144 -0.4064,-2.3114 v -13.76679 h 2.286 v 3.68299 q 0,0.4826 -0.0254,1.4732 0,0.9652 0,1.4478 0.1016,-0.5842 1.0414,-0.9652 0.9652,-0.4064 2.8194,-0.4064 5.08,0 5.08,3.4798 z m -2.3368,5.3848 v -4.826 q 0,-1.5748 -0.7366,-1.9812 -0.7366,-0.4318 -2.6162,-0.4318 -1.8034,0 -2.5146,0.4826 -0.7112,0.4826 -0.7112,1.9304 v 4.826 q 0,1.5494 0.6858,2.0066 0.7112,0.4318 2.5654,0.4318 1.8796,0 2.5908,-0.4318 0.7366,-0.4572 0.7366,-2.0066 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path875" /><path
d="m 86.933198,147.82162 h -3.2004 l -7.874,-8.763 7.366,-7.72159 h 2.9718 l -7.4168,7.61999 z m -11.1252,0 h -2.4638 v -16.48459 h 2.4638 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path877" /><path
d="m 99.53158,139.66822 v 4.2672 q 0,1.143 -0.2794,1.9304 -0.2794,0.7874 -0.7112,1.2192 -0.4318,0.4318 -1.2446,0.6604 -0.7874,0.2286 -1.524,0.2794 -0.7112,0.0508 -1.905,0.0508 -1.524,0 -2.3876,-0.1016 -0.8382,-0.1016 -1.7018,-0.4826 -0.8382,-0.4064 -1.2192,-1.27 -0.3556,-0.8636 -0.3556,-2.286 v -4.2672 q 0,-1.2192 0.2794,-2.0574 0.3048,-0.8382 0.7112,-1.2954 0.4318,-0.4572 1.2446,-0.6858 0.8128,-0.254 1.4986,-0.3048 0.7112,-0.0508 1.9304,-0.0508 1.2192,0 1.905,0.0508 0.7112,0.0508 1.524,0.3048 0.8128,0.2286 1.2192,0.6858 0.4318,0.4572 0.7112,1.2954 0.3048,0.8382 0.3048,2.0574 z m -2.3368,4.5974 v -4.9784 q 0,-1.7018 -0.6858,-2.1082 -0.6858,-0.4064 -2.6416,-0.4064 -1.9558,0 -2.6416,0.4064 -0.6858,0.4064 -0.6858,2.1082 v 4.9784 q 0,0.8128 0.1778,1.2954 0.1778,0.4826 0.6604,0.7112 0.4826,0.2032 0.9906,0.254 0.508,0.0508 1.4986,0.0508 0.9906,0 1.4986,-0.0508 0.508,-0.0508 0.9906,-0.254 0.4826,-0.2286 0.6604,-0.7112 0.1778,-0.4826 0.1778,-1.2954 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path879" /><path
d="m 113.6794,147.82162 h -2.286 v -8.89 q 0,-0.4572 -0.0762,-0.762 -0.0762,-0.3048 -0.3302,-0.6096 -0.2286,-0.3302 -0.8128,-0.4826 -0.5588,-0.1778 -1.4224,-0.1778 -2.0066,0 -2.6924,0.4318 -0.6858,0.4318 -0.6858,1.6002 v 8.89 h -2.286 v -12.2936 h 2.286 v 1.4986 q 0.3556,-1.7526 4.0386,-1.7526 2.4384,0 3.3528,0.889 0.9144,0.8636 0.9144,2.6416 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path881" /><path
d="m 128.513,139.66822 v 4.2672 q 0,1.143 -0.2794,1.9304 -0.2794,0.7874 -0.7112,1.2192 -0.4318,0.4318 -1.2446,0.6604 -0.7874,0.2286 -1.524,0.2794 -0.7112,0.0508 -1.905,0.0508 -1.524,0 -2.3876,-0.1016 -0.8382,-0.1016 -1.7018,-0.4826 -0.8382,-0.4064 -1.2192,-1.27 -0.3556,-0.8636 -0.3556,-2.286 v -4.2672 q 0,-1.2192 0.2794,-2.0574 0.3048,-0.8382 0.7112,-1.2954 0.4318,-0.4572 1.2446,-0.6858 0.8128,-0.254 1.4986,-0.3048 0.7112,-0.0508 1.9304,-0.0508 1.2192,0 1.905,0.0508 0.7112,0.0508 1.524,0.3048 0.8128,0.2286 1.2192,0.6858 0.4318,0.4572 0.7112,1.2954 0.3048,0.8382 0.3048,2.0574 z m -2.3368,4.5974 v -4.9784 q 0,-1.7018 -0.6858,-2.1082 -0.6858,-0.4064 -2.6416,-0.4064 -1.9558,0 -2.6416,0.4064 -0.6858,0.4064 -0.6858,2.1082 v 4.9784 q 0,0.8128 0.1778,1.2954 0.1778,0.4826 0.6604,0.7112 0.4826,0.2032 0.9906,0.254 0.508,0.0508 1.4986,0.0508 0.9906,0 1.4986,-0.0508 0.508,-0.0508 0.9906,-0.254 0.4826,-0.2286 0.6604,-0.7112 0.1778,-0.4826 0.1778,-1.2954 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path883" /><path
d="m 142.55921,135.52802 v 13.462 q 0,2.6162 -1.4732,3.5052 -1.4478,0.9144 -4.3688,0.9144 -2.6162,0 -4.2418,-0.2794 v -1.6256 q 2.921,0.3556 4.445,0.3556 1.7526,0 2.54,-0.5588 0.8128,-0.5588 0.8128,-1.8542 v -2.9464 q -0.0508,0.8636 -1.1938,1.2192 -1.1176,0.3556 -2.5654,0.3556 -2.8448,0 -3.8862,-0.8382 -1.016,-0.8382 -1.016,-2.8956 v -5.0038 q 0,-2.1844 1.1684,-3.1242 1.1938,-0.9398 3.8862,-0.9398 3.2004,0 3.7592,1.4478 v -1.1938 z m -2.286,8.9662 v -5.5626 q 0,-1.1938 -0.6604,-1.6256 -0.635,-0.4572 -2.667,-0.4572 -1.905,0 -2.4892,0.4318 -0.5842,0.4318 -0.5842,1.651 v 5.5626 q 0,1.27 0.6096,1.6764 0.635,0.381 2.5146,0.381 1.7272,0 2.4892,-0.4064 0.7874,-0.4318 0.7874,-1.651 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path885" /><path
d="m 157.39282,139.66822 v 4.2672 q 0,1.143 -0.2794,1.9304 -0.2794,0.7874 -0.7112,1.2192 -0.4318,0.4318 -1.2446,0.6604 -0.7874,0.2286 -1.524,0.2794 -0.7112,0.0508 -1.905,0.0508 -1.524,0 -2.3876,-0.1016 -0.8382,-0.1016 -1.7018,-0.4826 -0.8382,-0.4064 -1.2192,-1.27 -0.3556,-0.8636 -0.3556,-2.286 v -4.2672 q 0,-1.2192 0.2794,-2.0574 0.3048,-0.8382 0.7112,-1.2954 0.4318,-0.4572 1.2446,-0.6858 0.8128,-0.254 1.4986,-0.3048 0.7112,-0.0508 1.9304,-0.0508 1.2192,0 1.905,0.0508 0.7112,0.0508 1.524,0.3048 0.8128,0.2286 1.2192,0.6858 0.4318,0.4572 0.7112,1.2954 0.3048,0.8382 0.3048,2.0574 z m -2.3368,4.5974 v -4.9784 q 0,-1.7018 -0.6858,-2.1082 -0.6858,-0.4064 -2.6416,-0.4064 -1.9558,0 -2.6416,0.4064 -0.6858,0.4064 -0.6858,2.1082 v 4.9784 q 0,0.8128 0.1778,1.2954 0.1778,0.4826 0.6604,0.7112 0.4826,0.2032 0.9906,0.254 0.508,0.0508 1.4986,0.0508 0.9906,0 1.4986,-0.0508 0.508,-0.0508 0.9906,-0.254 0.4826,-0.2286 0.6604,-0.7112 0.1778,-0.4826 0.1778,-1.2954 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path887" /><path
d="m 171.54064,147.82162 h -2.286 v -8.89 q 0,-0.4572 -0.0762,-0.762 -0.0762,-0.3048 -0.3302,-0.6096 -0.2286,-0.3302 -0.8128,-0.4826 -0.5588,-0.1778 -1.4224,-0.1778 -2.0066,0 -2.6924,0.4318 -0.6858,0.4318 -0.6858,1.6002 v 8.89 h -2.286 v -12.2936 h 2.286 v 1.4986 q 0.3556,-1.7526 4.0386,-1.7526 2.4384,0 3.3528,0.889 0.9144,0.8636 0.9144,2.6416 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path889" /><path
d="m 186.52665,147.82162 h -2.8448 l -5.6134,-6.731 5.1816,-5.5626 h 2.794 l -5.334,5.5626 z m -8.7376,0 h -2.286 v -17.77999 h 2.286 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path891" /><path
d="m 198.26144,147.82162 h -2.2098 v -1.1684 q -0.2794,1.4224 -3.7084,1.4224 -2.54,0 -3.5306,-0.762 -0.9652,-0.7874 -0.9652,-3.1496 0,-2.0574 0.9144,-2.8194 0.9144,-0.7874 3.5306,-0.7874 h 3.683 v -1.9558 q 0,-1.016 -0.635,-1.3716 -0.6096,-0.3556 -2.3368,-0.3556 -1.8796,0 -4.2164,0.3048 v -1.6764 q 2.5146,-0.2286 4.5466,-0.2286 3.0988,0 4.0132,0.762 0.9144,0.7366 0.9144,3.0988 z m -2.286,-2.4892 v -3.3528 h -3.5306 q -1.5748,0 -1.9812,0.4064 -0.381,0.4064 -0.381,1.8542 0,1.2954 0.4064,1.8288 0.4318,0.508 1.778,0.508 h 0.4572 q 0.6604,0 1.0922,-0.0254 0.4572,-0.0254 1.016,-0.127 0.5588,-0.127 0.8382,-0.381 0.3048,-0.2794 0.3048,-0.7112 z"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#ffffff"
style="font-size:25.4px;font-family:Play;-inkscape-font-specification:'Play, Normal';fill:#3a3a3a;fill-opacity:1"
id="path893" /></g><g
id="g939"><path
id="g939"
style="filter:url(#filter17092)"><path
id="rect2890"
style="fill:#00ddff;fill-opacity:1;stroke-width:1.02576"
d="M 21.024968,155.29019 H 80.12021 l 0.03058,0.01 -5.965349,1.41604 -59.110532,4e-5 c -0.01693,0 -0.04392,-0.007 -0.03056,-0.01 l 5.950068,-1.40725 c 0.01336,-0.003 0.01363,-0.01 0.03056,-0.01 z"

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -29,7 +29,7 @@ public abstract class ExportAble {
int actuallyRead;
while (true) {
if ((actuallyRead = stream.read(block)) != blockSize)
throw new Exception("Read failure. Block Size: "+blockSize+", actuallyRead: "+actuallyRead);
throw new Exception("Read failure. "+blockSize+"/"+actuallyRead);
extractedFileBOS.write(block);
i += blockSize;
if ((i + blockSize) > size) {

View file

@ -18,21 +18,23 @@
*/
package libKonogonka.Tools.other.System2.ini1;
import java.nio.ByteBuffer;
public class KIP1Raw {
private KIP1Header headerObject;
private final byte[] header;
private final byte[] _textDecompressedSection;
private final byte[] _rodataDecompressedSection;
private final byte[] _dataDecompressedSection;
private final byte[] _roDataDecompressedSection;
private final byte[] _rwDataDecompressedSection;
KIP1Raw(byte[] header,
byte[] _textDecompressedSection,
byte[] _rodataDecompressedSection,
byte[] _dataDecompressedSection){
byte[] _roDataDecompressedSection,
byte[] _rwDataDecompressedSection){
this.header = header;
this._textDecompressedSection = _textDecompressedSection;
this. _rodataDecompressedSection = _rodataDecompressedSection;
this._dataDecompressedSection = _dataDecompressedSection;
this._roDataDecompressedSection = _roDataDecompressedSection;
this._rwDataDecompressedSection = _rwDataDecompressedSection;
try {
this.headerObject = new KIP1Header(header);
}
@ -42,6 +44,17 @@ public class KIP1Raw {
public KIP1Header getHeader() { return headerObject; }
public byte[] getHeaderRaw() {return header;}
public byte[] getTextRaw() {return _textDecompressedSection;}
public byte[] getRodataRaw() {return _rodataDecompressedSection;}
public byte[] getDataRaw() {return _dataDecompressedSection;}
public byte[] getRoDataRaw() {return _roDataDecompressedSection;}
public byte[] getRwDataRaw() {return _rwDataDecompressedSection;}
public byte[] getRaw(){
ByteBuffer entireKip1 = ByteBuffer.allocate(header.length +
_textDecompressedSection.length +
_roDataDecompressedSection.length +
_rwDataDecompressedSection.length);
entireKip1.put(header)
.put(_textDecompressedSection)
.put(_roDataDecompressedSection)
.put(_rwDataDecompressedSection);
return entireKip1.array();
}
}

View file

@ -38,7 +38,7 @@ public class AesCtrBufferedInputStream extends BufferedInputStream {
long mediaEndOffset,
InputStream inputStream,
long fileSize){
super(inputStream);
super(inputStream, 0x200);
this.decryptor = decryptor;
this.mediaOffsetPositionStart = ncaOffsetPosition + (mediaStartOffset * 0x200);
this.mediaOffsetPositionEnd = ncaOffsetPosition + (mediaEndOffset * 0x200);
@ -150,15 +150,17 @@ public class AesCtrBufferedInputStream extends BufferedInputStream {
byte[] chunkBytes = new byte[bytes];
long actuallyRead = super.read(chunkBytes, 0, bytes);
if (actuallyRead != bytes)
throw new IOException("Can't read: " + actuallyRead + "/"+ bytes);
throw new IOException("Can't read. " + actuallyRead + "/"+ bytes);
return chunkBytes;
}
private boolean isPointerInsideEncryptedSection(){
return (pseudoPos-pointerInsideDecryptedSection >= mediaOffsetPositionStart) && (pseudoPos-pointerInsideDecryptedSection < mediaOffsetPositionEnd);
return (pseudoPos-pointerInsideDecryptedSection >= mediaOffsetPositionStart) &&
(pseudoPos-pointerInsideDecryptedSection < mediaOffsetPositionEnd);
}
private boolean isEndPositionInsideEncryptedSection(long requestedBytesCount){
return ((pseudoPos-pointerInsideDecryptedSection + requestedBytesCount) >= mediaOffsetPositionStart) && ((pseudoPos-pointerInsideDecryptedSection + requestedBytesCount) < mediaOffsetPositionEnd);
return ((pseudoPos-pointerInsideDecryptedSection + requestedBytesCount) >= mediaOffsetPositionStart) &&
((pseudoPos-pointerInsideDecryptedSection + requestedBytesCount) < mediaOffsetPositionEnd);
}
@Override

View file

@ -29,7 +29,7 @@ public class InFileStreamProducer implements IProducer {
private final File file;
private final long initialOffset;
private long subOffset;
private final long subOffset;
private AesCtrDecryptForMediaBlocks decryptor;
private long mediaStartOffset;
private long mediaEndOffset;
@ -73,7 +73,7 @@ public class InFileStreamProducer implements IProducer {
mediaStartOffset,
mediaEndOffset,
Files.newInputStream(file.toPath()),
Files.size(file.toPath()));
Files.size(file.toPath())); // Files.size(file.toPath())-initialOffset); ?
skipBytesTillBeginning(stream, subOffset);
return stream;
}

View file

@ -41,7 +41,7 @@ public class AesCtrClassicBufferedInputStream extends BufferedInputStream {
long encryptedEndOffset,
InputStream inputStream,
long fileSize){
super(inputStream);
super(inputStream, 0x200);
this.decryptor = decryptor;
this.encryptedStartOffset = encryptedStartOffset;
this.encryptedEndOffset = encryptedEndOffset;

View file

@ -19,16 +19,13 @@
package libKonogonka.ctraesclassic;
import libKonogonka.IProducer;
import libKonogonka.RainbowDump;
import libKonogonka.ctraes.InFileStreamProducer;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FilterInputStream;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class InFileStreamClassicProducer implements IProducer {
private boolean encrypted;