Fix some edge condition errors in the cmap format 4 compaction code.