tmeiczin / opendcp

Created digital cinemas packages (DCP)
http://www.opendcp.org
GNU General Public License v3.0
122 stars 52 forks source link

3D mxf generation fails due to filename corruption #266

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
*Please fill in all defect information below.*

Product Version: latest master: de39daa436d9aefabe90cb427f61c7c7df2839ef
GUI or CLI: opendcp_mxf
Operating system: Centos/Linux

What steps will reproduce the problem?

Try to generate an .mxf from two sequences of .j2cs.

E.g. (paths removed):
/opendcp_mxf --log_level 4 --rate 24 --start 1 --end 67 --output 
.../dcp_out/ditest01_3d_14ftl_nowindows_dcdm_left_v001_right_v001_picture.mxf 
--left .../left/ditest01_3d_14ftl_nowindows_dcdm_left_v001_jpeg2k --right 
.../right/ditest01_3d_14ftl_nowindows_dcdm_right_v001_jpeg2k

What is the expected output?

A happy .mxf

What is actual output?

The command fails after logging the following:

---
20150218031052 | DEBUG | asdcp_intf.cpp:145                         | 
get_file_essence_class         | Reading file EssenceType: /jobs/a
20150218031052 | DEBUG | asdcp_intf.cpp:155                         | 
get_file_essence_class         | Unable to determine essence type
20150218031052 |  INFO | opendcp_mxf_cmd.c:460                      | main      
                     | Could not create MXF file

---

In this case "/jobs/a" is the first 7 characters of the input file path.

Please provide any additional information below.

I believe I have found and fixed the bug:

In opendcp_mxf_cmd.c are these lines:

115        snprintf(filelist->files[x], sizeof(filelist->files[x]), "%s", 
left->files[y]);
116        snprintf(filelist->files[x + 1], sizeof(filelist->files[x + 1]), 
"%s", right->files[y]);

Those "sizeof" calls are returning the size of the char* pointer, which is 8 
bytes, so only 8 characters are being copied into the 3D filelist (presumably, 
the 7 visible chars plus a null terminator).

I replaced those lines with these:

115        strncpy(filelist->files[x], left->files[y], MAX_FILENAME_LENGTH);
116        strncpy(filelist->files[x + 1], right->files[y], 
MAX_FILENAME_LENGTH);

That appears the fix the issue. The essence can be determined and the rest of 
the process seems to complete happily.

Cheers

Steve

Original issue reported on code.google.com by sagland on 18 Feb 2015 at 4:23

GoogleCodeExporter commented 9 years ago
Thanks, not sure what I was thinking when I wrote that. It should have been:

snprintf(filelist->files[x], MAX_FILENAME_LENGTH, "%s", left->files[y]);

stncpy should generally be avoided because it can lead to buffer overflows. 

Original comment by terrenc...@gmail.com on 18 Feb 2015 at 3:54

gdoise commented 7 years ago

For 3d functions i d'like to extend my bash script that use OPEN dcp CLI but i can't because of this issue. I understood that 0.30 wait a modification. This seem not be resolve at yet, so who can i obtain just the file an executable opendcp_mxf with your indications in this discussion ? I m not expert to compile a C programme . Could you give me the modified opendcp_mxf ? I could too try with the 0.27 version of OpenDcp but i cant retrieve this version anywhere ! Thanks a lot ! (Excuse me for my english not perfect )

gdoise commented 7 years ago

I progress (not enough in english perhaps) :

I found some old releases of OpenDCP : https://github.com/tmeiczin/opendcp/releases But i have difficulties to install thoses .zip files I know how to install with .deb files but my test with cmake... to create .deb .... failed :( ( see my participation this
OpenDCP 'install bash srcipt : In fact, i cant resolve this: ` cmake -DOPENSSL_ROOT_DIR=/usr/lib/i386-linux-gnu/ -DCMAKE_CXX_COMPILER_ID=GNU -DENABLE_GUI=ON /home/guillaume/bin/src/opendcp-0.29.0 ... ... ... -- Creating Upload Package Target -- -- /home/guillaume/bin/src/opendcp-0.29.0/scripts/googlecode_upload.py -s "OpenDCP 0.29.0 Linux DEB 32-bit" -p "OpenDCP" -u "terrence72@gmail.com" -l "Type-Package, Featured, OpSys-Linux" /home/guillaume/bin/opendcp-build/opendcp-0.29.0-linux.i386.deb CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: OPENJPEG_INCLUDE_DIR used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/libasdcp used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/libasdcp used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/libopendcp used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/cli used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/cli used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/cli used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/cli used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/cli used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/gui used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/gui used as include directory in directory /home/guillaume/bin/src/opendcp-0.29.0/upload

-- Configuring incomplete, errors occurred! See also "/home/guillaume/bin/opendcp-build/CMakeFiles/CMakeOutput.log". See also "/home/guillaume/bin/opendcp-build/CMakeFiles/CMakeError.log".`

gdoise commented 7 years ago

sorry for the layout !