Java: Fix NullPointerException in YUVImage

planes == null is a valid argument to setBuf() if alloc == true, so we
need to make sure that planes is non-null before validating its length.
We also need to allocate one dimension of the planes array if it's null.

Fixes #168
2 files changed
tree: acbd216e36e8a4863fafb7e456b46b23c65d26d9
  1. ci/
  2. cmakescripts/
  3. doc/
  4. java/
  5. md5/
  6. release/
  7. sharedlib/
  8. simd/
  9. testimages/
  10. win/
  11. .gitignore
  12. .travis.yml
  13. acinclude.m4
  14. appveyor.yml
  15. bmp.c
  16. bmp.h
  17. BUILDING.md
  18. cderror.h
  19. cdjpeg.c
  20. cdjpeg.h
  21. change.log
  22. ChangeLog.md
  23. cjpeg.1
  24. cjpeg.c
  25. CMakeLists.txt
  26. coderules.txt
  27. configure.ac
  28. djpeg.1
  29. djpeg.c
  30. doxygen-extra.css
  31. doxygen.config
  32. example.c
  33. jaricom.c
  34. jcapimin.c
  35. jcapistd.c
  36. jcarith.c
  37. jccoefct.c
  38. jccolext.c
  39. jccolor.c
  40. jcdctmgr.c
  41. jchuff.c
  42. jchuff.h
  43. jcinit.c
  44. jcmainct.c
  45. jcmarker.c
  46. jcmaster.c
  47. jcomapi.c
  48. jconfig.h.in
  49. jconfig.txt
  50. jconfigint.h.in
  51. jcparam.c
  52. jcphuff.c
  53. jcprepct.c
  54. jcsample.c
  55. jcstest.c
  56. jctrans.c
  57. jdapimin.c
  58. jdapistd.c
  59. jdarith.c
  60. jdatadst-tj.c
  61. jdatadst.c
  62. jdatasrc-tj.c
  63. jdatasrc.c
  64. jdcoefct.c
  65. jdcoefct.h
  66. jdcol565.c
  67. jdcolext.c
  68. jdcolor.c
  69. jdct.h
  70. jddctmgr.c
  71. jdhuff.c
  72. jdhuff.h
  73. jdinput.c
  74. jdmainct.c
  75. jdmainct.h
  76. jdmarker.c
  77. jdmaster.c
  78. jdmaster.h
  79. jdmerge.c
  80. jdmrg565.c
  81. jdmrgext.c
  82. jdphuff.c
  83. jdpostct.c
  84. jdsample.c
  85. jdsample.h
  86. jdtrans.c
  87. jerror.c
  88. jerror.h
  89. jfdctflt.c
  90. jfdctfst.c
  91. jfdctint.c
  92. jidctflt.c
  93. jidctfst.c
  94. jidctint.c
  95. jidctred.c
  96. jinclude.h
  97. jmemmgr.c
  98. jmemnobs.c
  99. jmemsys.h
  100. jmorecfg.h
  101. jpeg_nbits_table.h
  102. jpegcomp.h
  103. jpegint.h
  104. jpeglib.h
  105. jpegtran.1
  106. jpegtran.c
  107. jquant1.c
  108. jquant2.c
  109. jsimd.h
  110. jsimd_none.c
  111. jsimddct.h
  112. jstdhuff.c
  113. jutils.c
  114. jversion.h
  115. libjpeg.map.in
  116. libjpeg.txt
  117. LICENSE.md
  118. Makefile.am
  119. rdbmp.c
  120. rdcolmap.c
  121. rdgif.c
  122. rdjpgcom.1
  123. rdjpgcom.c
  124. rdppm.c
  125. rdrle.c
  126. rdswitch.c
  127. rdtarga.c
  128. README.ijg
  129. README.md
  130. structure.txt
  131. tjbench.c
  132. tjbenchtest.in
  133. tjbenchtest.java.in
  134. tjexampletest.in
  135. tjunittest.c
  136. tjutil.c
  137. tjutil.h
  138. transupp.c
  139. transupp.h
  140. turbojpeg-jni.c
  141. turbojpeg-mapfile
  142. turbojpeg-mapfile.jni
  143. turbojpeg.c
  144. turbojpeg.h
  145. usage.txt
  146. wizard.txt
  147. wrbmp.c
  148. wrgif.c
  149. wrjpgcom.1
  150. wrjpgcom.c
  151. wrppm.c
  152. wrppm.h
  153. wrrle.c
  154. wrtarga.c