<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:56:34 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>[SERVER-1275] DBClientCursor may call strlen on uninitialized bytes</title>
                <link>https://jira.mongodb.org/browse/SERVER-1275</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>
&lt;p&gt;See &lt;a href=&quot;http://github.com/mongodb/mongo/blob/master/client/dbclientcursor.cpp#L125&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/blob/master/client/dbclientcursor.cpp#L125&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If qr-&amp;gt;nReturned is zero, then qr-&amp;gt;data() returns a pointer to uninitialized bytes, which is then passed to DBConnector::checkResponse at the above line. But the signature of DBConnector::checkResponse requires that this call convert its first argument to a temporary std::string: that requires a call to strlen on the provided pointer. In the case under discussion, that leads to a call to strlen on an uninitialized buffer.&lt;/p&gt;

&lt;p&gt;Either line 125 should be changed to correctly handle the case where nReturned is zero, and not attempt to construct a temporary std::string in that case, or DBConnector::checkResponse should be changed to take a const char* first argument, and then correctly handle the case where its second argument is zero.&lt;/p&gt;

&lt;p&gt;This shows up in valgrind like this:&lt;/p&gt;

&lt;p&gt;	==15773== Conditional jump or move depends on uninitialised value(s)&lt;br/&gt;
	==15773==    at 0x4C2AA39: __GI_strlen (mc_replace_strmem.c:284)&lt;br/&gt;
	==15773==    by 0x8978A3F: std::basic_string&amp;lt;char, std::char_traits&amp;lt;char&amp;gt;, std::allocator&amp;lt;char&amp;gt; &amp;gt;::basic_string(char const*, std::allocator&amp;lt;char&amp;gt; const&amp;amp;) (in /usr/lib/libstdc++.so.6.0.13)&lt;br/&gt;
	==15773==    by 0x9F834ED: mongo::DBClientCursor::dataReceived() (dbclientcursor.cpp:125)&lt;br/&gt;
	==15773==    by 0x9F82C8E: mongo::DBClientCursor::init() (dbclientcursor.cpp:54)&lt;br/&gt;
	==15773==    by 0x9F78057: mongo::DBClientBase::query(std::string const&amp;amp;, mongo::Query, int, int, mongo::BSONObj const*, int, int) (dbclient.cpp:530)&lt;br/&gt;
	==15773==    by 0x9F7D181: mongo::DBClientConnection::query(std::string const&amp;amp;, mongo::Query, int, int, mongo::BSONObj const*, int, int) (dbclient.h:704)&lt;br/&gt;
	==15773==    by 0x9F7728D: mongo::DBClientInterface::findOne(std::string const&amp;amp;, mongo::Query, mongo::BSONObj const*, int) (dbclient.cpp:450)&lt;br/&gt;
       ...&lt;br/&gt;
	==15773==  Uninitialised value was created by a heap allocation&lt;br/&gt;
	==15773==    at 0x4C2940D: malloc (vg_replace_malloc.c:236)&lt;br/&gt;
	==15773==    by 0x9F3C03C: mongo::ourmalloc(unsigned long) (allocator.h:23)&lt;br/&gt;
	==15773==    by 0x9F57642: mongo::MessagingPort::recv(mongo::Message&amp;amp;) (message.cpp:391)&lt;br/&gt;
	==15773==    by 0x9F57863: mongo::MessagingPort::call(mongo::Message&amp;amp;, mongo::Message&amp;amp;) (message.cpp:426)&lt;br/&gt;
	==15773==    by 0x9F7A2AC: mongo::DBClientConnection::call(mongo::Message&amp;amp;, mongo::Message&amp;amp;, bool) (dbclient.cpp:789)&lt;br/&gt;
	==15773==    by 0x9F82C4B: mongo::DBClientCursor::init() (dbclientcursor.cpp:50)&lt;br/&gt;
	==15773==    by 0x9F78057: mongo::DBClientBase::query(std::string const&amp;amp;, mongo::Query, int, int, mongo::BSONObj const*, int, int) (dbclient.cpp:530)&lt;br/&gt;
	==15773==    by 0x9F7D181: mongo::DBClientConnection::query(std::string const&amp;amp;, mongo::Query, int, int, mongo::BSONObj const*, int, int) (dbclient.h:704)&lt;br/&gt;
	==15773==    by 0x9F7728D: mongo::DBClientInterface::findOne(std::string const&amp;amp;, mongo::Query, mongo::BSONObj const*, int) (dbclient.cpp:450)&lt;br/&gt;
        ...&lt;/p&gt;</description>
                <environment></environment>
        <key id="12217">SERVER-1275</key>
            <summary>DBClientCursor may call strlen on uninitialized bytes</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="andrew.morrow@mongodb.com">Andrew Morrow</reporter>
                        <labels>
                    </labels>
                <created>Mon, 21 Jun 2010 17:01:42 +0000</created>
                <updated>Tue, 12 Jul 2016 00:30:13 +0000</updated>
                            <resolved>Mon, 21 Jun 2010 17:58:23 +0000</resolved>
                                    <version>1.5.3</version>
                                    <fixVersion>1.5.4</fixVersion>
                                    <component>Internal Client</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="14918" author="acm" created="Mon, 21 Jun 2010 18:39:33 +0000"  >
&lt;p&gt;Thanks Eliot -&lt;/p&gt;

&lt;p&gt;I noticed that in the checkin above that you fixed the next issue I was about to report: that checkResponse was a shadowed virtual function. This actually breaks the codebase where we are trying to integrate the mongo C++ client, which builds with the GCC flag -Woverloaded-virtual to catch exactly this sort of issue. Unfortunately, we can&apos;t currently compile the mongo headers because of these shadowed virtuals, and we are reluctant to dial down our warnings.&lt;/p&gt;

&lt;p&gt;Here are some other shadowed functions exposed in the client headers:&lt;/p&gt;

&lt;p&gt;~/mongo.temp.install/include/mongo/client/dbclient.h:293: error: &apos;virtual bool mongo::DBClientWithCommands::auth(const std::string&amp;amp;, const std::string&amp;amp;, const std::string&amp;amp;, std::string&amp;amp;, bool)&apos; was hidden&lt;br/&gt;
~/mongo.temp.install/include/mongo/client/dbclient.h:785: error:   by &apos;bool mongo::DBClientPaired::auth(const std::string&amp;amp;, const std::string&amp;amp;, const std::string&amp;amp;, std::string&amp;amp;)&apos;&lt;br/&gt;
In file included from ~/mongo.temp.install/include/mongo/client/../db/db.h:22,&lt;br/&gt;
                 from ~/mongo.temp.install/include/mongo/client/../db/curop.h:24,&lt;br/&gt;
                 from ~/mongo.temp.install/include/mongo/client/../db/instance.h:23,&lt;br/&gt;
                 from ~/mongo.temp.install/include/mongo/client/../db/dbmessage.h:244,&lt;br/&gt;
                 from ~/mongo.temp.install/include/mongo/client/parallel.h:26,&lt;br/&gt;
                 from ./header_check.cc:22:&lt;br/&gt;
~/mongo.temp.install/include/mongo/client/dbclient.h: At global scope:&lt;br/&gt;
~/mongo.temp.install/include/mongo/client/dbclient.h:593: error: &apos;virtual std::auto_ptr&amp;lt;mongo::DBClientCursor&amp;gt; mongo::DBClientBase::query(const std::string&amp;amp;, mongo::Query, int, int, const mongo::BSONObj*, int, int)&apos; was hidden&lt;br/&gt;
~/mongo.temp.install/include/mongo/client/../db/instance.h:114: error:   by &apos;virtual std::auto_ptr&amp;lt;mongo::DBClientCursor&amp;gt; mongo::DBDirectClient::query(const std::string&amp;amp;, mongo::Query, int, int, const mongo::BSONObj*, int)&apos;&lt;/p&gt;

&lt;p&gt;These sorts of overloads are frequently buggy: maybe you should add -Woverloaded-virtual to your warning flags as well?&lt;/p&gt;

</comment>
                            <comment id="14916" author="auto" created="Mon, 21 Jun 2010 17:58:36 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;login&apos;: &apos;erh&apos;, &apos;name&apos;: &apos;Eliot Horowitz&apos;, &apos;email&apos;: &apos;eliot@10gen.com&apos;}
&lt;p&gt;Message: fix bad result handling &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1275&quot; title=&quot;DBClientCursor may call strlen on uninitialized bytes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1275&quot;&gt;&lt;del&gt;SERVER-1275&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://github.com/mongodb/mongo/commit/38f4332418be56f559de8cb71734490b1149ee03&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/mongodb/mongo/commit/38f4332418be56f559de8cb71734490b1149ee03&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 21 Jun 2010 17:58:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 years, 35 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 years, 35 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpl0f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrikkv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>21986</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrnvif:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>