<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:27:20 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-12006] Fixed potential pointer overflow leading to infinite loop</title>
                <link>https://jira.mongodb.org/browse/SERVER-12006</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Fixed potential pointer overflow leading to an infinite loop in&lt;br/&gt;
db/storage/record.cpp&lt;/p&gt;

&lt;p&gt;In order to iterate over the data in the record there was a previous loop that&lt;br/&gt;
compared pointers:&lt;/p&gt;

&lt;p&gt;    const char * addr = _data;&lt;br/&gt;
    const char * end = _data + _netLength();&lt;br/&gt;
    for ( ; addr &amp;lt;= end ; addr += 2048 ) {&lt;br/&gt;
        __record_touch_dummy += addr&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;this will not work as expected because the addr pointer may overflow.&lt;/p&gt;

&lt;p&gt;Consider the size of _data, where it is defined in mongo::ps::Slice as:&lt;/p&gt;

&lt;p&gt;    Entry _data&lt;span class=&quot;error&quot;&gt;&amp;#91;SliceSize&amp;#93;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Here _netLength is defined as:&lt;/p&gt;

&lt;p&gt;    int _netLength() const &lt;/p&gt;
{ return _lengthWithHeaders - HeaderSize; }

&lt;p&gt;in mongo/db/pdfile.h. Where HeaderSize = 16 and _lengthWithHeaders is set in a&lt;br/&gt;
number of places through the function:&lt;/p&gt;

&lt;p&gt;    int&amp;amp; lengthWithHeaders() &lt;/p&gt;
{ _accessing(); return _lengthWithHeaders; }

&lt;p&gt;in mongo/db/pdfile.h.&lt;/p&gt;

&lt;p&gt;Assuming we can&apos;t guarantee anything about the exact value of _netLength (for&lt;br/&gt;
example, that it&apos;s always exactly a multiple of 2048) then there will be an&lt;br/&gt;
issue with the addr pointer overflowing the bounds of _data.&lt;/p&gt;

&lt;p&gt;In C, it is undefined behavior to increment a pointer (in this case addr) more&lt;br/&gt;
than 1 past the end of the array (in this case _data) to which it points.&lt;/p&gt;

&lt;p&gt;If the compiler so chooses, it may wrap around the pointer if it increases past&lt;br/&gt;
_data + SliceSize + 1. This would cause this loop to never exit because addr&lt;br/&gt;
would always be less than end.&lt;/p&gt;</description>
                <environment>All</environment>
        <key id="101616">SERVER-12006</key>
            <summary>Fixed potential pointer overflow leading to infinite loop</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="schwerin@mongodb.com">Andy Schwerin</assignee>
                                    <reporter username="jaredlwong">Jared Wong</reporter>
                        <labels>
                            <label>pull-request</label>
                    </labels>
                <created>Mon, 9 Dec 2013 06:06:44 +0000</created>
                <updated>Mon, 11 Jul 2016 17:38:11 +0000</updated>
                            <resolved>Fri, 13 Dec 2013 21:56:50 +0000</resolved>
                                                    <fixVersion>2.5.5</fixVersion>
                                    <component>Storage</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="470753" author="xgen-internal-githook" created="Fri, 13 Dec 2013 21:55:57 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jaredlwong&apos;, u&apos;name&apos;: u&apos;Jared Wong&apos;, u&apos;email&apos;: u&apos;jaredlwong@gmail.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-12006&quot; title=&quot;Fixed potential pointer overflow leading to infinite loop&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-12006&quot;&gt;&lt;del&gt;SERVER-12006&lt;/del&gt;&lt;/a&gt; - Fixed potential pointer overflow leading to an infinite loop in db/storage/record.cpp&lt;/p&gt;

&lt;p&gt;In order to iterate over the data in the record there was a previous loop that&lt;br/&gt;
compared pointers. This will not work as expected because the addr pointer may&lt;br/&gt;
overflow.&lt;/p&gt;

&lt;p&gt;In C, it is undefined behavior to increment a pointer (in this case addr) more&lt;br/&gt;
than 1 past the end of the array (in this case _data) to which it points.&lt;/p&gt;

&lt;p&gt;If the compiler so chooses, it may wrap around the pointer if it increases past&lt;br/&gt;
_data + SliceSize + 1. This would cause this loop to never exit because addr&lt;br/&gt;
would always be less than end.&lt;/p&gt;

&lt;p&gt;Signed-off-by: Matt Kangas &amp;lt;matt.kangas@mongodb.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/9ebb366ef046a10875640493cf0560359e9221b2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/9ebb366ef046a10875640493cf0560359e9221b2&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>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 13 Dec 2013 19:06:58 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 9 weeks, 5 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>
                            10 years, 9 weeks, 5 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>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jaredlwong</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrm5xj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>92963</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_10166" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Tests Written</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10153"><![CDATA[Unneeded]]></customfieldvalue>

                        </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|hrktjj:</customfieldvalue>

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