<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:08:18 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CDRIVER-45] unchecked malloc and realloc in gridfs_store_stream</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-45</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;In gridfs_store_stream, there are unchecked malloc and realloc calls.&lt;br/&gt;
if any of those fail with NULL, the following code will dereference NULL,&lt;br/&gt;
probably provoking a segfault:&lt;/p&gt;

&lt;p&gt;  if ( to_write &amp;lt; gfs-&amp;gt;chunk_len ) {&lt;br/&gt;
    if( gfs-&amp;gt;pending_data ) &lt;/p&gt;
{
      gfs-&amp;gt;pending_data = (char *)realloc((void *)gfs-&amp;gt;pending_data, gfs-&amp;gt;pending_len + to_write);
      memcpy( gfs-&amp;gt;pending_data + gfs-&amp;gt;pending_len, data, length );
    }
&lt;p&gt; else if (to_write &amp;gt; 0) &lt;/p&gt;
{
      gfs-&amp;gt;pending_data = (char *)malloc(to_write);
      memcpy( gfs-&amp;gt;pending_data, data, length );
    }
&lt;p&gt;    gfs-&amp;gt;pending_len += length;&lt;br/&gt;
  } else {&lt;/p&gt;


&lt;p&gt;I didn&apos;t try to fix it because I suspect the function is incomplete.&lt;br/&gt;
Its return type is &quot;bson&quot;, yet there is no return statement.&lt;/p&gt;</description>
                <environment>latest in git</environment>
        <key id="14781">CDRIVER-45</key>
            <summary>unchecked malloc and realloc in gridfs_store_stream</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="kbanker">Kyle Banker</assignee>
                                    <reporter username="meyering">Jim Meyering</reporter>
                        <labels>
                    </labels>
                <created>Thu, 17 Feb 2011 16:54:20 +0000</created>
                <updated>Wed, 3 May 2017 22:14:27 +0000</updated>
                            <resolved>Thu, 17 Feb 2011 20:06:46 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="24144" author="kbanker" created="Thu, 17 Feb 2011 20:06:46 +0000"  >&lt;p&gt;Thanks, Jim!&lt;/p&gt;</comment>
                            <comment id="24143" author="auto" created="Thu, 17 Feb 2011 20:04:31 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;banker&apos;, u&apos;name&apos;: u&apos;Kyle Banker&apos;, u&apos;email&apos;: u&apos;kylebanker@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-45&quot; title=&quot;unchecked malloc and realloc in gridfs_store_stream&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-45&quot;&gt;&lt;del&gt;CDRIVER-45&lt;/del&gt;&lt;/a&gt; check calls to malloc and realloc&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/f7aacc269bf52d9a42210dc3dc11ca4b813573e0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/f7aacc269bf52d9a42210dc3dc11ca4b813573e0&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="14779">CDRIVER-43</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh6wv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13919</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>