Hello,
I built libde265 and libheif from git and I am able to trigger following assert with 
[scaling_list_pred_matrix_id_delta.zip](https://github.com/strukturag/libde265/files/10058129/scaling_list_pred_matrix_id_delta.zip)

```
heif-convert clusterfuzz-testcase-minimized-kimgio_heif_fuzzer-6222100054016000.fuzz output.png
File contains 1 image
heif-convert: sps.cc:931: de265_error read_scaling_list(bitreader*, const seq_parameter_set*, scaling_list_data*, bool): Assertion `scaling_list_pred_matrix_id_delta==3' failed.
```

Same file in GIMP 2.99.14 for Windows create following message:
`Assertion failed: scaling_list_pred_matrix_id_delta==3, file ../../libde265-1.0.9/libde265/sps.cc, line 931`

There is another case https://github.com/strukturag/libde265/issues/313 which looks similar.

```
#0  0x00007ffff7ab0fac in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007ffff7a63b62 in raise () from /lib64/libc.so.6
#2  0x00007ffff7a4e471 in abort () from /lib64/libc.so.6
#3  0x00007ffff7a4e395 in __assert_fail_base.cold () from /lib64/libc.so.6
#4  0x00007ffff7a5cb12 in __assert_fail () from /lib64/libc.so.6
#5  0x00007ffff73ced3a in read_scaling_list (br=br@entry=0x7fffffffd290, sps=sps@entry=0x55555557e3d0, sclist=sclist@entry=0x55555557e64e, inPPS=inPPS@entry=false) at sps.cc:931
#6  0x00007ffff73d0693 in seq_parameter_set::read (this=this@entry=0x55555557e3d0, errqueue=errqueue@entry=0x55555557c978, br=br@entry=0x7fffffffd290) at sps.cc:350
#7  0x00007ffff73a914d in decoder_context::read_sps_NAL (this=this@entry=0x55555557c970, reader=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr_base.h:1295
#8  0x00007ffff73ab320 in decoder_context::decode_NAL (this=this@entry=0x55555557c970, nal=0x55555557c850) at decctx.cc:1248
#9  0x00007ffff73ab5fe in decoder_context::decode (this=0x55555557c970, more=0x7fffffffd354) at decctx.cc:1327
#10 0x00007ffff739ff44 in de265_decode (de265ctx=<optimized out>, more=<optimized out>) at de265.cc:352
#11 0x00007ffff7f760b3 in libde265_v1_decode_image (decoder_raw=0x55555557b850, out_img=0x7fffffffd410) at plugins/heif_decoder_libde265.cc:324
#12 0x00007ffff7f53e27 in heif::HeifContext::decode_image_planar (this=0x5555555780f0, ID=<optimized out>, img=std::shared_ptr<heif::HeifPixelImage> (empty) = {...},
    out_colorspace=out_colorspace@entry=heif_colorspace_RGB, options=options@entry=0x55555557c8d0, alphaImage=false) at heif_context.cc:1181
#13 0x00007ffff7f550b3 in heif::HeifContext::decode_image_user (this=<optimized out>, ID=<optimized out>, img=std::shared_ptr<heif::HeifPixelImage> (empty) = {...}, out_colorspace=heif_colorspace_RGB,
    out_chroma=heif_chroma_interleaved_RGB, options=0x55555557c8d0) at heif_context.cc:1088
#14 0x00007ffff7f42d8e in heif_decode_image (in_handle=0x55555557b9e0, out_img=0x7fffffffd888, colorspace=<optimized out>, chroma=<optimized out>, options=<optimized out>) at heif.cc:946
#15 0x0000555555559644 in main (argc=<optimized out>, argv=<optimized out>) at heif_convert.cc:329
```
Assertion `scaling_list_pred_matrix_id_delta==3' failed.
This is a GitHub Issue
repo:libde265
owner:strukturag
Title : Assertion `scaling_list_pred_matrix_id_delta==3' failed.
Issue date:

--- start body ---
Hello,
I built libde265 and libheif from git and I am able to trigger following assert with 
[scaling_list_pred_matrix_id_delta.zip](https://github.com/strukturag/libde265/files/10058129/scaling_list_pred_matrix_id_delta.zip)

```
heif-convert clusterfuzz-testcase-minimized-kimgio_heif_fuzzer-6222100054016000.fuzz output.png
File contains 1 image
heif-convert: sps.cc:931: de265_error read_scaling_list(bitreader*, const seq_parameter_set*, scaling_list_data*, bool): Assertion `scaling_list_pred_matrix_id_delta==3' failed.
```

Same file in GIMP 2.99.14 for Windows create following message:
`Assertion failed: scaling_list_pred_matrix_id_delta==3, file ../../libde265-1.0.9/libde265/sps.cc, line 931`

There is another case https://github.com/strukturag/libde265/issues/313 which looks similar.

```
#0  0x00007ffff7ab0fac in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007ffff7a63b62 in raise () from /lib64/libc.so.6
#2  0x00007ffff7a4e471 in abort () from /lib64/libc.so.6
#3  0x00007ffff7a4e395 in __assert_fail_base.cold () from /lib64/libc.so.6
#4  0x00007ffff7a5cb12 in __assert_fail () from /lib64/libc.so.6
#5  0x00007ffff73ced3a in read_scaling_list (br=br@entry=0x7fffffffd290, sps=sps@entry=0x55555557e3d0, sclist=sclist@entry=0x55555557e64e, inPPS=inPPS@entry=false) at sps.cc:931
#6  0x00007ffff73d0693 in seq_parameter_set::read (this=this@entry=0x55555557e3d0, errqueue=errqueue@entry=0x55555557c978, br=br@entry=0x7fffffffd290) at sps.cc:350
#7  0x00007ffff73a914d in decoder_context::read_sps_NAL (this=this@entry=0x55555557c970, reader=...) at /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/include/g++-v11/bits/shared_ptr_base.h:1295
#8  0x00007ffff73ab320 in decoder_context::decode_NAL (this=this@entry=0x55555557c970, nal=0x55555557c850) at decctx.cc:1248
#9  0x00007ffff73ab5fe in decoder_context::decode (this=0x55555557c970, more=0x7fffffffd354) at decctx.cc:1327
#10 0x00007ffff739ff44 in de265_decode (de265ctx=<optimized out>, more=<optimized out>) at de265.cc:352
#11 0x00007ffff7f760b3 in libde265_v1_decode_image (decoder_raw=0x55555557b850, out_img=0x7fffffffd410) at plugins/heif_decoder_libde265.cc:324
#12 0x00007ffff7f53e27 in heif::HeifContext::decode_image_planar (this=0x5555555780f0, ID=<optimized out>, img=std::shared_ptr<heif::HeifPixelImage> (empty) = {...},
    out_colorspace=out_colorspace@entry=heif_colorspace_RGB, options=options@entry=0x55555557c8d0, alphaImage=false) at heif_context.cc:1181
#13 0x00007ffff7f550b3 in heif::HeifContext::decode_image_user (this=<optimized out>, ID=<optimized out>, img=std::shared_ptr<heif::HeifPixelImage> (empty) = {...}, out_colorspace=heif_colorspace_RGB,
    out_chroma=heif_chroma_interleaved_RGB, options=0x55555557c8d0) at heif_context.cc:1088
#14 0x00007ffff7f42d8e in heif_decode_image (in_handle=0x55555557b9e0, out_img=0x7fffffffd888, colorspace=<optimized out>, chroma=<optimized out>, options=<optimized out>) at heif.cc:946
#15 0x0000555555559644 in main (argc=<optimized out>, argv=<optimized out>) at heif_convert.cc:329
```
--- end body ---

An assertion failure in the libde265 library indicates a potential vulnerability when processing specially crafted HEIF files. The assertion `scaling_list_pred_matrix_id_delta==3` failing suggests that the library may not handle certain input correctly, leading to a crash. This could be exploited to cause a Denial of Service (DoS) by providing malicious files that trigger this assertion failure.