tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Ensure no nullptr dereference #2685

Closed micl2e2 closed 11 months ago

micl2e2 commented 11 months ago

There is no checks before constructing the tl_object secret_api::decryptedMessage, in which a pointer dereference happens. This patch fixes the potential nullptr dereference.

levlam commented 11 months ago

The proposed patch is just wrong. The text can be null and there is no way a nullptr dereference can happen in the code.

micl2e2 commented 11 months ago

Okay. If all callers effectively ensure that the text is non-null, then this patch is probably redundant. But even that, it is based on m being non-null, do all callers effectively ensure it too? If so, my consideration would be less than useful.

levlam commented 11 months ago

text is a local variable, so it is irrelevant, what is passed by the callers. Not all messages have text, therefore text for sure can be null, but it is definitely non-null for messages of the type MessageContentType::Text.

Also, there is no way or need to send null messages, so m is never null, which can be easely checked by the source code.

micl2e2 commented 11 months ago

quite make sense, then this is an unnecessary patch.

harlene83774179 commented 11 months ago

How you would know?

Sent from Yahoo Mail on Android

On Sun, Nov 19, 2023 at 6:12 PM, Michael @.***> wrote:

Okay. If all callers effectively ensure that the text is non-null, then this patch is probably redundant. But even that, it is based on m being nonnull, does all callers effectively ensured it too? If so, my consideration would be less than useful.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>