The zbin compressor fixup utility rounds down file sizes before calculating their difference. This produces incorrect values and may cause truncated gPXE images to be loaded at boot. The following example explains the problem: ilen = 48 bytes (uncompressed input file) olen = 17 bytes (compressed output file) divisor = 16 bytes (paragraph granularity) fixmeup = 3 paragraphs (value to fix up) olen / divisor - ilen / divisor = 1 - 3 = -2 paragraphs (old delta calculation) ( align ( olen, divisor ) - align ( ilen, divisor ) ) / divisor = 2 - 3 = -1 paragraphs (new delta calculation) If we perform the SUBx operation with old delta: fixmeup + -2 = 1 paragraph gets loaded by the prefix With the new delta: fixmeup + -1 = 2 paragraphs get loaded by the prefix The old delta calculation removes the last paragraph; the prefix will load a truncated copy of gPXE into memory. We need to load 2 paragraphs since olen is 17 bytes. Loading only 1 paragraph (16 bytes) would truncate the last byte. Signed-off-by: Michael Brown <mcb30@etherboot.org>tags/v0.9.8
|
|
||
57 |
|
57 |
|
58 |
|
58 |
|
59 |
|
59 |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
60 |
|
64 |
|
61 |
|
65 |
|
62 |
|
66 |
|
|
|
||
140 |
|
144 |
|
141 |
|
145 |
|
142 |
|
146 |
|
143 |
|
|
|
144 |
|
147 |
|
145 |
|
148 |
|
146 |
|
149 |
|
147 |
|
150 |
|
148 |
|
151 |
|
149 |
|
152 |
|
150 |
|
|
|
|
153 |
|
|
151 |
|
154 |
|
152 |
|
155 |
|
153 |
|
156 |
|
|
|
||
170 |
|
173 |
|
171 |
|
174 |
|
172 |
|
175 |
|
173 |
|
|
|
174 |
|
176 |
|
175 |
|
177 |
|
176 |
|
178 |
|
|
|
||
178 |
|
180 |
|
179 |
|
181 |
|
180 |
|
182 |
|
181 |
|
|
|
|
183 |
|
|
182 |
|
184 |
|
183 |
|
185 |
|
184 |
|
186 |
|
|
|
||
222 |
|
224 |
|
223 |
|
225 |
|
224 |
|
226 |
|
225 |
|
|
|
226 |
|
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
227 |
|
230 |
|
228 |
|
231 |
|
229 |
|
232 |
|
|
|
||
251 |
|
254 |
|
252 |
|
255 |
|
253 |
|
256 |
|
254 |
|
|
|
|
257 |
|
|
255 |
|
258 |
|
256 |
|
259 |
|
257 |
|
260 |
|