Integer overflow issue fixed in "calc_pressure" API
This commit is contained in:
parent
03340ac138
commit
af22c4b636
@ -7,9 +7,9 @@ The sensor driver package includes bme680.h, bme680.c and bme680_defs.h files
|
|||||||
## Version
|
## Version
|
||||||
File | Version | Date
|
File | Version | Date
|
||||||
--------------|---------|-------------
|
--------------|---------|-------------
|
||||||
bme680.c | 3.5.6 | 19 Jan 2018
|
bme680.c | 3.5.7 | 05 Feb 2018
|
||||||
bme680.h | 3.5.6 | 19 Jan 2018
|
bme680.h | 3.5.7 | 05 Feb 2018
|
||||||
bme680_defs.h | 3.5.6 | 19 Jan 2018
|
bme680_defs.h | 3.5.7 | 05 Feb 2018
|
||||||
|
|
||||||
## Integration details
|
## Integration details
|
||||||
* Integrate bme680.h, bme680_defs.h and bme680.c file in to your project.
|
* Integrate bme680.h, bme680_defs.h and bme680.c file in to your project.
|
||||||
|
6
bme680.c
6
bme680.c
@ -40,8 +40,8 @@
|
|||||||
* patent rights of the copyright holder.
|
* patent rights of the copyright holder.
|
||||||
*
|
*
|
||||||
* File bme680.c
|
* File bme680.c
|
||||||
* @date 19 Jan 2018
|
* @date 05 Feb 2018
|
||||||
* @version 3.5.6
|
* @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;
|
var1 = ((32768 + var1) * (int32_t)dev->calib.par_p1) >> 15;
|
||||||
pressure_comp = 1048576 - pres_adc;
|
pressure_comp = 1048576 - pres_adc;
|
||||||
pressure_comp = (int32_t)((pressure_comp - (var2 >> 12)) * ((uint32_t)3125));
|
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)
|
if (pressure_comp >= var4)
|
||||||
pressure_comp = ((pressure_comp / (uint32_t)var1) << 1);
|
pressure_comp = ((pressure_comp / (uint32_t)var1) << 1);
|
||||||
else
|
else
|
||||||
|
4
bme680.h
4
bme680.h
@ -40,8 +40,8 @@
|
|||||||
* patent rights of the copyright holder.
|
* patent rights of the copyright holder.
|
||||||
*
|
*
|
||||||
* @file bme680.h
|
* @file bme680.h
|
||||||
* @date 19 Jan 2018
|
* @date 05 Feb 2018
|
||||||
* @version 3.5.6
|
* @version 3.5.7
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
* patent rights of the copyright holder.
|
* patent rights of the copyright holder.
|
||||||
*
|
*
|
||||||
* @file bme680_defs.h
|
* @file bme680_defs.h
|
||||||
* @date 19 Jan 2018
|
* @date 05 Feb 2018
|
||||||
* @version 3.5.6
|
* @version 3.5.7
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
All notable changes to the BME680 Sensor API will be documented in this file.
|
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
|
## v3.5.6, 19 Jan 2018
|
||||||
### Added
|
### Added
|
||||||
- Floating point support added for the API
|
- Floating point support added for the API
|
||||||
|
Loading…
Reference in New Issue
Block a user