avcodec/hevc_ps: check that VPS referenced from SPS exists
This matches how its done for SPS/PPS.
An alternative to this is to check it when its used.
Fixes null pointer dereference
Fixes: signal_sigsegv_e30a43_1437_CIP_A_Panasonic_3.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d66bab0a69)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
			
			
This commit is contained in:
		@@ -621,6 +621,12 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
 | 
				
			|||||||
        goto err;
 | 
					        goto err;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!s->vps_list[sps->vps_id]) {
 | 
				
			||||||
 | 
					        av_log(s->avctx, AV_LOG_ERROR, "VPS does not exist \n");
 | 
				
			||||||
 | 
					        ret = AVERROR_INVALIDDATA;
 | 
				
			||||||
 | 
					        goto err;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sps->max_sub_layers = get_bits(gb, 3) + 1;
 | 
					    sps->max_sub_layers = get_bits(gb, 3) + 1;
 | 
				
			||||||
    if (sps->max_sub_layers > MAX_SUB_LAYERS) {
 | 
					    if (sps->max_sub_layers > MAX_SUB_LAYERS) {
 | 
				
			||||||
        av_log(s->avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n",
 | 
					        av_log(s->avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user