Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

rhel 7
integer weakness #8


Weakness Breakdown


An integer overflow occurs when the answer to an arithmetic operation exceeds the maximum size of the integer type used to store it. The resulting value will appear to have wrapped around the maximum value and started again at the minimum value. This would look like a clock that represents 13:00 by pointing at 1:00. An attacker can use an integer overflow during a buffer length calculation, which results in the allocated buffer being too small to hold the data copied into it, thus causing a buffer overflow.

Warning code(s):

Unless checked, the resulting number can exceed the expected range.

File Name:



The highlighted line of code below is the trigger point of this particular Red Hat Enterprise Linux 7 integer weakness.

 		_tmp6_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, TRF_TYPE_PERSONA_STORE, TrfPersonaStore));
		trf_store = _tmp6_;
		_tmp7_ = trf_store;
		_tmp8_ = trf_persona_store_get_favorite_id (_tmp7_);
		favorite_tracker_id = _tmp8_;
		_tmp9_ = favourite;
		_tmp11_ = _tmp10_ = g_strsplit (_tmp9_, ",", 0);
			gchar** tag_collection = NULL;
			gint tag_collection_length1 = 0;
			gint _tag_collection_size_ = 0;
			gint tag_it = 0;
			tag_collection = _tmp11_;
			tag_collection_length1 = _vala_array_length (_tmp10_);
			for (tag_it = 0; tag_it < _vala_array_length (_tmp10_); tag_it = tag_it + 1) {
				gchar* _tmp12_;
				gchar* tag = NULL;
				_tmp12_ = g_strdup (tag_collection[tag_it]);
				tag = _tmp12_;
					const gchar* _tmp13_;
					gint _tmp14_;
					gint _tmp15_;
					_tmp13_ = tag;
					_tmp14_ = atoi (_tmp13_);
					_tmp15_ = favorite_tracker_id;
					if (_tmp14_ == _tmp15_) {
						is_favourite = TRUE;
					_g_free0 (tag);
			tag_collection = (_vala_array_free (tag_collection, tag_collection_length1, (GDestroyNotify) g_free), NULL);
		_g_object_unref0 (trf_store);
	_tmp16_ = is_favourite;
	_tmp17_ = self->priv->_is_favourite;
	if (_tmp16_ != _tmp17_) {
		gboolean _tmp18_;
		_tmp18_ = is_favourite;
		self->priv->_is_favourite = _tmp18_;
		g_object_notify ((GObject*) self, "is-favourite");
	_g_free0 (favourite);

   * This method sets the is_favourite attribute internally. 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.