Giter VIP home page Giter VIP logo

Comments (3)

AndroidGorny avatar AndroidGorny commented on June 21, 2024 1

Actually, the buffer overflow happens in many SDK functions, when using library on Ubuntu 18.04 64 bit platform.

System:
OS: Ubuntu 18.04.3 LTS
OS type: 64-bit
Memory: 8GB

Biostar SDK library version: 2.6.3.16 (have also tried 2.6.3.13 an 2.6.3.19 beta release) - results are always the same

Few examples:

Test case No.1
=============================================

void* _pBiostarContext = NULL;

int main(){

	printf("Application started!\n");

	_pBiostarContext = BS2_AllocateContext();

	if(_pBiostarContext != NULL){

		int nResult = BS2_Initialize(_pBiostarContext);

		if(nResult != BS_SDK_SUCCESS){
			printf("Failed to initialize context!\n");
                        BS2_ReleaseContext(_pBiostarContext);
			return EXIT_FAILURE;
		}

		printf("Using Biostar library version %s\n", BS2_Version());

	} 
	else{
		printf("Failed to allocate context!\n");
		return EXIT_FAILURE;
	}

	BS2_ReleaseContext(_pBiostarContext); // <-- Can not get past this

	printf("Application finished!\n");
	return EXIT_SUCCESS;
}

Expected output:

Application started!
Using Biostar library version 2.6.3.16
Application finished!

Actual output:

Application started!
Using Biostar library version 2.6.3.16
*** buffer overflow detected ***

Test case No.2 (failed reader connection)
=============================================

void* _pBiostarContext = NULL;
const char* _cHost = "<Invalid reader IP here>";
int _nPort = 51211;.
int _nbiostarDeviceId = 0;

int main(){

	printf("Application started!\n");

	_pBiostarContext = BS2_AllocateContext();

	if(_pBiostarContext != NULL){

		int nResult = BS2_Initialize(_pBiostarContext);

		if(nResult != BS_SDK_SUCCESS){
			printf("Failed to initialize context!\n");
                        BS2_ReleaseContext(_pBiostarContext);
			return EXIT_FAILURE;
		}

		printf("Using Biostar library version %s\n", BS2_Version());

	} 
	else{
		printf("Failed to allocate context!\n");
		return EXIT_FAILURE;
	}

	printf("Connecting to reader\n");

	while(BS_SDK_SUCCESS != BS2_ConnectDeviceViaIP(_pBiostarContext, 
		_cHost, _nPort, &_nBiostarDeviceId)) // <-- Buffer overflow if the connection does not succeed
	{
		printf("Retrying reader connection\n"); // <-- Never gets here
	}
	
	printf("Connected to reader\n");
	/*Rest of the application code
	..........	
	*/
	BS2_ReleaseContext(_pBiostarContext);
	printf("Application finished!\n");
	return EXIT_SUCCESS;
}

Expected output:

Application started!
Using Biostar library version 2.6.3.16
Connecting to reader!
Retrying reader connection
Retrying reader connection
And so on....

Actual output:

Using Biostar library version 2.6.3.16
Connecting to reader
*** buffer overflow detected ***

from biostar2_device_sdk.

liepauls avatar liepauls commented on June 21, 2024

Same issue here

from biostar2_device_sdk.

vadim-perco avatar vadim-perco commented on June 21, 2024

This problem solved in SDK 2.6.3.23

from biostar2_device_sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.