Integer overflow issue fixed in "calc_pressure" API

This commit is contained in:
Bosch Sensortec 2018-02-12 12:57:50 +01:00
parent 03340ac138
commit af22c4b636
5 changed files with 14 additions and 10 deletions

View File

@ -7,9 +7,9 @@ The sensor driver package includes bme680.h, bme680.c and bme680_defs.h files
## Version
File | Version | Date
--------------|---------|-------------
bme680.c | 3.5.6 | 19 Jan 2018
bme680.h | 3.5.6 | 19 Jan 2018
bme680_defs.h | 3.5.6 | 19 Jan 2018
bme680.c | 3.5.7 | 05 Feb 2018
bme680.h | 3.5.7 | 05 Feb 2018
bme680_defs.h | 3.5.7 | 05 Feb 2018
## Integration details
* Integrate bme680.h, bme680_defs.h and bme680.c file in to your project.

View File

@ -40,8 +40,8 @@
* patent rights of the copyright holder.
*
* File bme680.c
* @date 19 Jan 2018
* @version 3.5.6
* @date 05 Feb 2018
* @version 3.5.7
*
*/
@ -924,7 +924,7 @@ static uint32_t calc_pressure(uint32_t pres_adc, const struct bme680_dev *dev)
var1 = ((32768 + var1) * (int32_t)dev->calib.par_p1) >> 15;
pressure_comp = 1048576 - pres_adc;
pressure_comp = (int32_t)((pressure_comp - (var2 >> 12)) * ((uint32_t)3125));
var4 = (INT32_C(1) << 31);
var4 = (int32_t)(((uint32_t)1) << 31);
if (pressure_comp >= var4)
pressure_comp = ((pressure_comp / (uint32_t)var1) << 1);
else

View File

@ -40,8 +40,8 @@
* patent rights of the copyright holder.
*
* @file bme680.h
* @date 19 Jan 2018
* @version 3.5.6
* @date 05 Feb 2018
* @version 3.5.7
* @brief
*
*/

View File

@ -40,8 +40,8 @@
* patent rights of the copyright holder.
*
* @file bme680_defs.h
* @date 19 Jan 2018
* @version 3.5.6
* @date 05 Feb 2018
* @version 3.5.7
* @brief
*
*/

View File

@ -1,6 +1,10 @@
# Change Log
All notable changes to the BME680 Sensor API will be documented in this file.
## v3.5.7, 05 Feb 2018
### Fixed
- Integer overflow issue fixed in "calc_pressure" API
## v3.5.6, 19 Jan 2018
### Added
- Floating point support added for the API