• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/intel-driver


Commit MetaInfo

Revision32def604997b4e9f8046b2d4d728de14ceb16c28 (tree)
Zeit2016-05-24 14:11:15
AutorXiang, Haihao <haihao.xiang@inte...>
CommiterXiang, Haihao

Log Message

Avoid potential NULL pointer access

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>

Ändern Zusammenfassung

Diff

--- a/src/gen9_vdenc.c
+++ b/src/gen9_vdenc.c
@@ -2221,6 +2221,9 @@ gen9_vdenc_init_img_states(VADriverContextP ctx,
22212221
22222222 pbuffer = i965_map_gpe_resource(&vdenc_context->vdenc_avc_image_state_res);
22232223
2224+ if (!pbuffer)
2225+ return;
2226+
22242227 mfx_img_cmd = (struct gen9_mfx_avc_img_state *)pbuffer;
22252228 gen9_vdenc_init_mfx_avc_img_state(ctx, encode_state, encoder_context, mfx_img_cmd);
22262229 pbuffer += sizeof(*mfx_img_cmd);
@@ -2245,6 +2248,9 @@ gen9_vdenc_huc_brc_update_constant_data(VADriverContextP ctx,
22452248
22462249 pbuffer = i965_map_gpe_resource(&vdenc_context->brc_constant_data_res);
22472250
2251+ if (!pbuffer)
2252+ return;
2253+
22482254 if (vdenc_context->internal_rate_mode == I965_BRC_VBR) {
22492255 memcpy(gen9_brc_update_constant_data.dist_qp_adj_tab_i, dist_qp_adj_tab_i_vbr, sizeof(dist_qp_adj_tab_i_vbr));
22502256 memcpy(gen9_brc_update_constant_data.dist_qp_adj_tab_p, dist_qp_adj_tab_p_vbr, sizeof(dist_qp_adj_tab_p_vbr));
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -2543,10 +2543,12 @@ i965_MapBuffer(VADriverContextP ctx,
25432543 struct i965_driver_data *i965 = i965_driver_data(ctx);
25442544 struct object_buffer *obj_buffer = BUFFER(buf_id);
25452545 VAStatus vaStatus = VA_STATUS_ERROR_UNKNOWN;
2546- struct object_context *obj_context = CONTEXT(obj_buffer->context_id);
2546+ struct object_context *obj_context;
25472547
25482548 ASSERT_RET(obj_buffer && obj_buffer->buffer_store, VA_STATUS_ERROR_INVALID_BUFFER);
25492549
2550+ obj_context = CONTEXT(obj_buffer->context_id);
2551+
25502552 /* When the wrapper_buffer exists, it will wrapper to the
25512553 * buffer allocated from backend driver.
25522554 */