Commit 08a71d10 authored by Jamie McCrae's avatar Jamie McCrae Committed by Jamie
Browse files

boot: bootutil: swap_scratch: Fix compressed image sector size check



Fixes an issue with compressed update support whereby it would wrong
continue to check all sector sizes and error due to the sector sizes
of the secondary slot being 0 until overflow

Signed-off-by: default avatarJamie McCrae <jamie.mccrae@nordicsemi.no>
parent d69933cd
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -191,7 +191,17 @@ boot_slots_compatible(struct boot_loader_state *state)
            smaller = 1;
            i++;
        } else {
            sz1 += boot_img_sector_size(state, BOOT_SECONDARY_SLOT, j);
            size_t sector_size = boot_img_sector_size(state, BOOT_SECONDARY_SLOT, j);

#ifdef MCUBOOT_DECOMPRESS_IMAGES
            if (sector_size == 0) {
                /* Since this supports decompressed images, we can safely exit if slot1 is
                 * smaller than slot0.
                 */
                break;
            }
#endif
            sz1 += sector_size;
            /* Guarantee that multiple sectors of the primary slot
             * fit into the secondary slot.
             */