<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:08:57 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>[MONGOCRYPT-558] FLE2RangeFindDriverSpec_to_ciphertexts leads to double-initializing bson_t</title>
                <link>https://jira.mongodb.org/browse/MONGOCRYPT-558</link>
                <project id="17481" key="MONGOCRYPT">Libmongocrypt</project>
                    <description>&lt;p&gt;In &lt;tt&gt;FLE2RangeFindDriverSpec_to_ciphertexts&lt;/tt&gt; in &lt;tt&gt;mongocrypt-ctx-encrypt.c&lt;/tt&gt;, a Valgrind memory leak can occur when the libbson &lt;tt&gt;BSON_MEMCHECK&lt;/tt&gt; compile flag is set because:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;bson_t with_placholders&lt;/tt&gt; is initialized on &lt;a href=&quot;https://github.com/mongodb/libmongocrypt/blob/2ec9c3c4ff94f76bb51a5b4cc2fe9190457d6541/src/mongocrypt-ctx-encrypt.c#L1730&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;line 1730 (as of commit &lt;tt&gt;2ec9c3&lt;/tt&gt;)&lt;/a&gt; with &lt;tt&gt;BSON_INITIALIZER&lt;/tt&gt;&lt;/li&gt;
	&lt;li&gt;The function calls &lt;tt&gt;mc_FLE2RangeFindDriverSpec_to_placeholders&lt;/tt&gt; on &lt;a href=&quot;https://github.com/mongodb/libmongocrypt/blob/2ec9c3c4ff94f76bb51a5b4cc2fe9190457d6541/src/mongocrypt-ctx-encrypt.c#L1768&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;line 1768&lt;/a&gt; and passes &lt;tt&gt;with_placholders&lt;/tt&gt; as the &lt;tt&gt;out&lt;/tt&gt; argument.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;mc_FLE2RangeFindDriverSpec_to_placeholders&lt;/tt&gt; calls &lt;tt&gt;bson_init&lt;/tt&gt; on &lt;tt&gt;out&lt;/tt&gt; on &lt;a href=&quot;https://github.com/mongodb/libmongocrypt/blob/2ec9c3c4ff94f76bb51a5b4cc2fe9190457d6541/src/mc-fle2-rfds.c#L508&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;line 508&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;One possible solution is to remove the extra call to &lt;tt&gt;bson_init&lt;/tt&gt; within the &lt;tt&gt;mc_FLE2RangeFindDriverSpec_to_placeholders&lt;/tt&gt; function. Note that there is a &lt;a href=&quot;https://github.com/mongodb/libmongocrypt/blob/2ec9c3c4ff94f76bb51a5b4cc2fe9190457d6541/test/test-mc-fle2-rfds.c#L480-L492&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;test case&lt;/a&gt; in &lt;tt&gt;test-mc-fle2-rfds.c&lt;/tt&gt; that uses &lt;tt&gt;mc_FLE2RangeFindDriverSpec_to_placeholders&lt;/tt&gt; and the &lt;tt&gt;out&lt;/tt&gt; argument passed to that test function will need to be initialized if this change is made. &lt;/p&gt;

&lt;p&gt;&#8212;&lt;/p&gt;

&lt;p&gt;To reproduce the memory leak, use&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #ff1493; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mkdir&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; cmake-build &amp;amp;&amp;amp; &lt;/span&gt;&lt;span style=&quot;color: #ff1493; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; cmake-build&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;cmake ../&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: #ff1493; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;make&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;valgrind --leak-check=full .&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;/test-mongocrypt&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment></environment>
        <key id="2285732">MONGOCRYPT-558</key>
            <summary>FLE2RangeFindDriverSpec_to_ciphertexts leads to double-initializing bson_t</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="kyle.kloberdanz@mongodb.com">Kyle Kloberdanz</assignee>
                                    <reporter username="zachary.espiritu@mongodb.com">Zachary Espiritu</reporter>
                        <labels>
                    </labels>
                <created>Fri, 10 Mar 2023 15:20:30 +0000</created>
                <updated>Thu, 27 Apr 2023 19:22:44 +0000</updated>
                            <resolved>Thu, 27 Apr 2023 19:22:44 +0000</resolved>
                                                    <fixVersion>1.8.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="5382425" author="xgen-internal-githook" created="Thu, 27 Apr 2023 19:22:09 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Kyle Kloberdanz&apos;, &apos;email&apos;: &apos;kyle.kloberdanz@mongodb.com&apos;, &apos;username&apos;: &apos;kkloberdanz&apos;}
&lt;p&gt;Message: Improve bson_t initialization behavior (#629)&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/MONGOCRYPT-558&quot; title=&quot;FLE2RangeFindDriverSpec_to_ciphertexts leads to double-initializing bson_t&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MONGOCRYPT-558&quot;&gt;&lt;del&gt;MONGOCRYPT-558&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/MONGOCRYPT-559&quot; title=&quot;_fle2_mongo_op_markings and _create_markings_cmd_bson are double-initializing bson_t&#8217;s&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MONGOCRYPT-559&quot;&gt;&lt;del&gt;MONGOCRYPT-559&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/MONGOCRYPT-560&quot; title=&quot;_fle2_insert_encryptionInformation raises Valgrind errors on bson_t&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MONGOCRYPT-560&quot;&gt;&lt;del&gt;MONGOCRYPT-560&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This addresses the issues brought up in the above tickets. We will not be removing calls to `BSON_INITIALIZER`, but we are addressing the other issues uncovered in these tickets.&lt;/p&gt;

&lt;p&gt;Co-authored-by: Kevin Albertson &amp;lt;kevin.albertson@10gen.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/libmongocrypt/commit/ec15461d69cd740d9b8b5f195fc920a2347005dd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/libmongocrypt/commit/ec15461d69cd740d9b8b5f195fc920a2347005dd&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_21957" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Binding Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="22966"><![CDATA[Not Needed]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6i7r:f0whi</customfieldvalue>

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