Fix build error of generating fec data

When we make the fec data for spare images, we will check each
chunk the length of spare image but not the total length.
If the libspare sends the data which is not a multiple of 4096,
there is an error.

We have reproduced it using our image.

The data is send by
https://android.googlesource.com/platform/system/core/+/fca4a9c27950a4a4281de0f413280cff9f4da653/libsparse/output_file.cpp#272

, and is checked by
https://android.googlesource.com/platform/system/extras/+/29bf737e56e10c2742f1e14fe9f07184d59bbcc0/verity/fec/image.cpp#179

If the to_write in first link is equal INT_MAX, the assert in second
link will be failed.

Test: use fec to product fec data successfully
      ./fec --encode --roots 2 system.img fecdata

Change-Id: Ib1e310a32bcda8acb3785d3784537d84fd439732
1 file changed