You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by dvirsky <gi...@git.apache.org> on 2015/06/02 10:00:25 UTC

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

GitHub user dvirsky opened a pull request:

    https://github.com/apache/thrift/pull/511

    Limit lists to 10,000 items in fastbinary decoding to avoid crashing …

    …servers from huge allocations on junk/mallicious input
    
    https://issues.apache.org/jira/browse/THRIFT-3175

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/EverythingMe/thrift THRIFT-3175

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/511.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #511
    
----
commit 988defdbdc12d2f087c0a87f8f6205b41f8588aa
Author: Dvir Volk <dv...@gmail.com>
Date:   2015-06-02T07:55:43Z

    Limit lists to 10,000 items in fastbinary decoding to avoid crashing servers from huge allocations on junk/mallicious input

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by dvirsky <gi...@git.apache.org>.
Github user dvirsky commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/511#discussion_r31605192
  
    --- Diff: lib/py/src/protocol/fastbinary.c ---
    @@ -936,7 +951,7 @@ decode_struct(DecodeBuffer* input, PyObject* output, PyObject* spec_seq) {
     }
     
     
    -/* --- MAIN RECURSIVE INPUT FUNCTION --- */
    +/* --- MAIN RECURSIVE INPUT FUCNTION --- */
    --- End diff --
    
    fixed in 9994c6e55f3c11acc523545c1ca67deb05cd0910


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by dvirsky <gi...@git.apache.org>.
Github user dvirsky commented on the pull request:

    https://github.com/apache/thrift/pull/511#issuecomment-107866723
  
    The build failure seems to be unrelated to the patch:
    
    ```
    ...
    vector-0.10.12.3 failed during the building phase. The exception was:
    ExitFailure 9
    This may be due to an out-of-memory condition.
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by bufferoverflow <gi...@git.apache.org>.
Github user bufferoverflow commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/511#discussion_r31599161
  
    --- Diff: lib/py/src/protocol/fastbinary.c ---
    @@ -1028,7 +1043,7 @@ decode_val(DecodeBuffer* input, TType type, PyObject* typeargs) {
         }
     
         len = readI32(input);
    -    if (!check_ssize_t_32(len)) {
    +    if (!check_list_length(len)) {
           return NULL;
    --- End diff --
    
    I guess we need to inform the user about reaching the limit somehow, e.g. via PyErr_SetString


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/thrift/pull/511


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by dvirsky <gi...@git.apache.org>.
Github user dvirsky commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/511#discussion_r31604906
  
    --- Diff: lib/py/src/protocol/fastbinary.c ---
    @@ -1028,7 +1043,7 @@ decode_val(DecodeBuffer* input, TType type, PyObject* typeargs) {
         }
     
         len = readI32(input);
    -    if (!check_ssize_t_32(len)) {
    +    if (!check_list_length(len)) {
           return NULL;
    --- End diff --
    
    check_list_length already does that:
    ```c
       PyErr_SetString(PyExc_OverflowError, "list size out of the sanity limit (10000 items max)");
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by bufferoverflow <gi...@git.apache.org>.
Github user bufferoverflow commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/511#discussion_r31599079
  
    --- Diff: lib/py/src/protocol/fastbinary.c ---
    @@ -936,7 +951,7 @@ decode_struct(DecodeBuffer* input, PyObject* output, PyObject* spec_seq) {
     }
     
     
    -/* --- MAIN RECURSIVE INPUT FUNCTION --- */
    +/* --- MAIN RECURSIVE INPUT FUCNTION --- */
    --- End diff --
    
    What's this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Limit lists to 10,000 items in fastbinary dec...

Posted by dvirsky <gi...@git.apache.org>.
Github user dvirsky commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/511#discussion_r31604879
  
    --- Diff: lib/py/src/protocol/fastbinary.c ---
    @@ -936,7 +951,7 @@ decode_struct(DecodeBuffer* input, PyObject* output, PyObject* spec_seq) {
     }
     
     
    -/* --- MAIN RECURSIVE INPUT FUNCTION --- */
    +/* --- MAIN RECURSIVE INPUT FUCNTION --- */
    --- End diff --
    
    I'll fix the typo


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---