### ImageMagick version

7.1.1-31

### Operating system

Linux

### Operating system, version and so on

Ubuntu 22.04

### Description

Recently (between ImageMagick 7.1.1-28 and 7.1.1-31), I have been seeing some errors when working with some GIF images in conjunction with ICC profiles.

It looks like GIF images that have attached XMP metadata are now having that XMP metadata being incorrectly interpreted as ICC profiles. This causes further use of ICC profiles to emit errors.

To save some possible distractions / red herrings... XMP Application Extension Blocks in GIF images _look_ bogus at first but they _do_ work. The Application Data Sub-blocks don't properly specify their length. It looks like the folks at Adobe(?) were being unnecessarily clever here by assuming their XMP XML data contains no null bytes and putting trailer data of a countdown of bytes from 255 to 0 at the end of the data to collect all the wild sub-block lengths in to one final Block Terminator. This means that these blocks look funny at first, but they _do_ work out in the end. I wasted a bunch of time going down this rabbit hole, hopefully I can save you some grief :) .

### Steps to Reproduce

```
magick rose_with_xmp.gif -profile sRGB2014.icc rose.jpg
```

Observe the following output:
```
magick: UnableToTransformColorspace `rose_with_xmp.gif', not an ICC profile, invalid signature (#11) @ warning/profile.c/CMSExceptionHandler/513.
magick: ColorspaceColorProfileMismatch `icc' @ error/profile.c/ProfileImage/1085.
```

### Images

rose_with_xmp.gif:
![rose_with_xmp](https://github.com/ImageMagick/ImageMagick/assets/316852/3a6fcf1d-0f5c-4436-95c5-5a9d5429ed3b)

sRGB2014.icc:
https://color.org/srgbprofiles.xalter#v2
XMP metadata attached to GIF images is misinterpreted as an ICC profile
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : XMP metadata attached to GIF images is misinterpreted as an ICC profile
Issue date:

--- start body ---
### ImageMagick version

7.1.1-31

### Operating system

Linux

### Operating system, version and so on

Ubuntu 22.04

### Description

Recently (between ImageMagick 7.1.1-28 and 7.1.1-31), I have been seeing some errors when working with some GIF images in conjunction with ICC profiles.

It looks like GIF images that have attached XMP metadata are now having that XMP metadata being incorrectly interpreted as ICC profiles. This causes further use of ICC profiles to emit errors.

To save some possible distractions / red herrings... XMP Application Extension Blocks in GIF images _look_ bogus at first but they _do_ work. The Application Data Sub-blocks don't properly specify their length. It looks like the folks at Adobe(?) were being unnecessarily clever here by assuming their XMP XML data contains no null bytes and putting trailer data of a countdown of bytes from 255 to 0 at the end of the data to collect all the wild sub-block lengths in to one final Block Terminator. This means that these blocks look funny at first, but they _do_ work out in the end. I wasted a bunch of time going down this rabbit hole, hopefully I can save you some grief :) .

### Steps to Reproduce

```
magick rose_with_xmp.gif -profile sRGB2014.icc rose.jpg
```

Observe the following output:
```
magick: UnableToTransformColorspace `rose_with_xmp.gif', not an ICC profile, invalid signature (#11) @ warning/profile.c/CMSExceptionHandler/513.
magick: ColorspaceColorProfileMismatch `icc' @ error/profile.c/ProfileImage/1085.
```

### Images

rose_with_xmp.gif:
![rose_with_xmp](https://github.com/ImageMagick/ImageMagick/assets/316852/3a6fcf1d-0f5c-4436-95c5-5a9d5429ed3b)

sRGB2014.icc:
https://color.org/srgbprofiles.xalter#v2
--- end body ---
