### CI Link

https://gradle-enterprise.elastic.co/s/tolzhhuvjvobo/tests/:server:test/org.elasticsearch.gateway.PersistedClusterStateServiceTests/testHandlesShuffledDocuments%20%7Bseed=%5B6281127015198EC1:C2E270963902654%5D%7D?top-execution=1

### Repro line

./gradlew ':server:test' --tests "org.elasticsearch.gateway.PersistedClusterStateServiceTests.testHandlesShuffledDocuments {seed=[6281127015198EC1:C2E270963902654]}" -Dtests.seed=6281127015198EC1 -Dtests.locale=ca -Dtests.timezone=Africa/Asmera -Druntime.java=18

### Does it reproduce?

No

### Applicable branches

master, maybe others

### Failure history

_No response_

### Failure excerpt

```
2> junit.framework.AssertionFailedError: Unexpected exception type, expected CorruptStateException but got java.lang.IndexOutOfBoundsException: Range [4, 4 + -3) out of bounds for length 1 |  
-- | --
  | at __randomizedtesting.SeedInfo.seed([6281127015198EC1:C2E270963902654]:0) |  
  | at org.apache.lucene.tests.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2850) |  
  | at org.apache.lucene.tests.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2831) |  
  | at org.elasticsearch.gateway.PersistedClusterStateServiceTests.testHandlesShuffledDocuments(PersistedClusterStateServiceTests.java:1149) |  
  |   |  
  | Caused by: |  
  | java.lang.IndexOutOfBoundsException: Range [4, 4 + -3) out of bounds for length 1 |  
  | at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) |  
  | at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromIndexSize(Preconditions.java:118) |  
  | at java.base/jdk.internal.util.Preconditions.checkFromIndexSize(Preconditions.java:397) |  
  | at java.base/java.util.Objects.checkFromIndexSize(Objects.java:411) |  
  | at org.elasticsearch.common.bytes.BytesArray.slice(BytesArray.java:95) |  
  | at org.elasticsearch.common.compress.DeflateCompressor.uncompress(DeflateCompressor.java:208) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.uncompress(PersistedClusterStateService.java:660) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.consumeFromType(PersistedClusterStateService.java:622) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.loadOnDiskState(PersistedClusterStateService.java:551) |  
  | at org.elasticsearch.gateway.PersistedClusterStateService.loadBestOnDiskState(PersistedClusterStateService.java:458) |  
  | at org.elasticsearch.gateway.PersistedClusterStateServiceTests.loadPersistedClusterState(PersistedClusterStateServiceTests.java:1633) |  
  | at org.elasticsearch.gateway.PersistedClusterStateServiceTests.lambda$testHandlesShuffledDocuments$30(PersistedClusterStateServiceTests.java:1149) |  
  | at org.apache.lucene.tests.util.LuceneTestCase._expectThrows(LuceneTestCase.java:3003) |  
  | at org.apache.lucene.tests.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2840) |  
  | ... 2 more
```

I haven't been able to get a reliable reproduction line, but usually running the test 10,000 times seems to provoke it:

```
for i in {0..100}; do ./gradlew ':server:test' -Dtests.iters=100 --tests "org.elasticsearch.gateway.PersistedClusterStateServiceTests.testHandlesShuffledDocuments"; done
```
server/src/main/java/org/elasticsearch/common/compress/DeflateCompressor.java
private static final byte[] HEADER = new byte[] { 'D', 'F', 'L', '\0' };