Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table CRC Tool Fails to Close File Descriptor #1

Closed
skliper opened this issue Jun 24, 2019 · 1 comment
Closed

Table CRC Tool Fails to Close File Descriptor #1

skliper opened this issue Jun 24, 2019 · 1 comment
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Jun 24, 2019

Analysis of the 27b VPU FSW code revealed that there is a potential leak of an allocated resource in the file cfe_ts_crc.c. The resource "fd" is opened but never closed before the function returns.

VpuTopProject/cfs/CFE/tools/tblCRCTool/cfe_ts_crc.c
143 /* open the input file if possible /
-->144 fd = open( argv[1], O_RDONLY );
145 if ( fd < 0 )
146 {
147 printf("\ncfe_ts_crc error: can't open input file!\n");
148 exit(0);
149 }
150 /
seek past the number of bytes requested /
151 lseek( fd, skipSize, SEEK_SET );
152
153 /
read the input file 100 bytes at a time /
154 while ( done == 0 )
155 {
156 readSize = read(fd, buffer, 100);
157 fileCRC = CFE_ES_CalculateCRC(buffer, readSize, fileCRC, CFE_ES_CRC_16);
158 fileSize += readSize;
159 if (readSize != 100) done=1;
160 }
161 /
print the size/CRC results */
162 printf("\nTable File Name: %s\nTable Size: %d Bytes\nExpected TS Validation CRC: 0x%08X\n\n", argv[1], fileSize, fileCRC);
163
164 return(fileCRC);
165 }

@skliper skliper added the bug Something isn't working label Jun 24, 2019
@skliper skliper added this to the 1.1.0 milestone Jun 24, 2019
@skliper skliper added the good first issue Good for newcomers label Jun 24, 2019
@avan989
Copy link

avan989 commented Aug 29, 2019

I can do this.

skliper pushed a commit that referenced this issue Sep 10, 2019
skliper pushed a commit that referenced this issue Sep 10, 2019
skliper added a commit that referenced this issue Sep 10, 2019
Reviewed and approved at 2019-09-04 CCB
skliper added a commit that referenced this issue Sep 10, 2019
Reviewed and approved at 2019-09-04 CCB
skliper pushed a commit that referenced this issue Sep 12, 2019
skliper added a commit that referenced this issue Sep 12, 2019
Reviewed and approved at 2019-09-04 CCB
skliper added a commit that referenced this issue Sep 12, 2019
skliper added a commit that referenced this issue Sep 12, 2019
Reviewed and approved at 2019-09-04 CCB
skliper added a commit that referenced this issue Sep 16, 2019
skliper added a commit that referenced this issue Sep 16, 2019
Fasttracked to test
skliper added a commit that referenced this issue Sep 16, 2019
Fasttracked to test
@skliper skliper closed this as completed in d995f5e Oct 1, 2019
skliper added a commit that referenced this issue Oct 1, 2019
Fasttracked to test, reviewed at 2019-09-25 CCB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants