From patchwork Fri May 10 16:05:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Zhao X-Patchwork-Id: 13065 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D1176446CAC for ; Fri, 10 May 2019 19:13:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9B85689D7A; Fri, 10 May 2019 19:13:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8A0FB68062B for ; Fri, 10 May 2019 19:13:18 +0300 (EEST) Received: by mail-pf1-f169.google.com with SMTP id 13so3473214pfw.9 for ; Fri, 10 May 2019 09:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CUNaB4ElfLq/LFMfxZFg6h95BYiju0c7ZzLfIUbiGy4=; b=VovPQItaIGgO/JerO+rJ8HPI2Fgl9kgd47yuB5igvTtHELWYLxOKuz/6cj0+o08rn1 nCG4LKwJ7PQoHUcj+8mPgNX9MH9MT5aYpqArw+/F0yQV60u0fWTgMwS7CE7lXkPp5RVm 0caZPDYM1iPXcc8Lwh2xir+NPrkGe3Wik0OjFSX/AOsqTT0yFEW8Gz8K7kBXYfc4zqJV TG5Hc5ZNUf+6TL0meS2O3pZdskAgYDJkUFOc0DRk/TByw/JpDKhqhGFXt5T2nBB8CDa7 J9scl0KWhfazmI8FSNSoYFwETEMmHahD2gxzK3nD7VuKyUJ5nX3mav/KIK7yVoDqx352 72HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CUNaB4ElfLq/LFMfxZFg6h95BYiju0c7ZzLfIUbiGy4=; b=B2ooMFiswfCuls/ZD5wUg+6Zw+UxbAaPTQ0hp7STjnPkOQ8D8WvNhOZF/yYu+WU1aM ycje+8u0AS1hzpjrx/5j7HZLiWSTaY8emSZj7X9nIyUqu3gGAag4JYB7b7h6u/NgMxUO SrrHhH4ZhfcVz7FTPa3vTr88fiMr3RN5+ZcB/52Bzp0Gz7fU0HEk3on3axPT84Zi6Wbd 7EIPf6s4c+MmfmBw77yoCPQECsBE0IhUl8/ql0WB6J4f5H+0JdD3uEfSe5mWOzlqpDG9 Zf6lxgqTumkPysgoWVRl3cCqAlGhwmTmMMAO8Kn7DVmpnqIQpMuKI7P9lhwSWRU5Ghsa zmJA== X-Gm-Message-State: APjAAAUKcukBBku3psvu7IRs3l9DsQ1NJjOxle1thUuWGR/p4UmosjdD 3VSHMILonUt+UkB7lrcdicendXjx X-Google-Smtp-Source: APXvYqweUFIkGuvfAAjgOzqY2QQt9+vFpZv4+lLQwYbXJ2l4zZgk1YXx+DVp0GYdGkoXu3wzpOXliw== X-Received: by 2002:a62:cfc4:: with SMTP id b187mr15872758pfg.134.1557504362519; Fri, 10 May 2019 09:06:02 -0700 (PDT) Received: from localhost.localdomain ([47.90.47.25]) by smtp.gmail.com with ESMTPSA id n64sm12016622pfb.38.2019.05.10.09.06.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 09:06:02 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2019 00:05:50 +0800 Message-Id: <1557504354-27086-2-git-send-email-mypopydev@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1557504354-27086-1-git-send-email-mypopydev@gmail.com> References: <1557504354-27086-1-git-send-email-mypopydev@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/6] lavc/avpacket: check NULL before using the pointer X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Jun Zhao MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Jun Zhao Need to check NULL before using the pointer Signed-off-by: Jun Zhao --- libavcodec/avpacket.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 8f0603d..2b20067 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -522,11 +522,12 @@ fail: int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict) { - const uint8_t *end = data + size; + const uint8_t *end; int ret = 0; if (!dict || !data || !size) return ret; + end = data + size; if (size && end[-1]) return AVERROR_INVALIDDATA; while (data < end) {